If you need the res_nXXX functions, you might want to try statically
linking with the libbind from BIND 8 instead of your OS's resolver
library. That way you won't need to tell people to have libbind installed.

The solution also depends on the OS's you'll be supporting. I've tried
building a recent libbind (8.4.4) on Windows and failed, and from what I
understand it's not exactly trivial. On some versions you also need to
modify the libbind.exp file if you use functions not included there (for
example res_nclose, IIRC). I didn't have these problems on UNIX, though.

libbind in the BIND9 source is actually the same library as in BIND 8.
BIND 9 uses libdns and libisc (and a few others), which seem to be
intended to be internal APIs - they are design according to the
internals of the new name server. They are more difficult to use than
standard libbind.

Jose Marcio Martins da Cruz wrote:

>Hello,
>
>I'm writting a multithreaded application which needs to do DNS
>queries. All I need is to query about A and MXs records and
>eventually TXT records.
>
>As it's a multithreaded application, I can't use res_query and
>similar functions, but res_nquery...
>
>The first problem is that most OSs doesn't have res_nNNN series
>of functions in their libraries.
>
>So I digged into bind 9 code and checked libbind.
>
>I saw many other people writting many different solutions to do
>dns queries inside multithreaded applications, but none of them
>is integrated on a standard library.
>
>What could be a good solution for me, without having to dig into
>specific DNS communications programming ? Integrating libbind
>code into my application, asking people to install libbind into
>their system or is there any other better library I could base
>my application ?
>
>I've already wrote some functions to do what I want to parse
>DNS packets, I get using res_NNN functions.
>
>Jose-Marcio
>
>
>