[gambit-list] res_query in the FFI

Lang Martin lang-gb at coptix.com
Thu Oct 12 11:39:06 EDT 2006


I'm trying to make a largish number of DNS MX type queries,
thread-safely. I made a djbdns FFI, that works great. It's not thread
safe -- the library internally uses global state variables.

So.

Started working on res_query, which seems like it's probably thread
safe.  However, res_query returns it's answer as a buffer of some size
of u_char's.

What do I do with those? There's the type conversion thing in the
manual for ECDIC characters which is incomplete, and it seems as
though the unicode support in Gambit is implemented through byte
ports.

Should I create a port? If so, can someone point me to a bit of the
source code that'll get me started with that?

Should I convert the answer string to some other format? I'd like to
preserve any unicode characters that return from DNS.

Should I return a byte vector from the function and run some
scheme-land conversion on it to create a string? that'd be nice, I'm
not really a C programmer.

If someone can light my way, I'd appreciate it.

Lang



More information about the Gambit-list mailing list