Linking problems with BIND8's libbind on Windows.

Sudhir Mohith smohith at us.ibm.com
Mon Aug 25 18:54:16 UTC 2003





Hello,

I am using the BIND 8.4.1 libbind code as part of a naming service project
on Windows (I'm using Visual Studio 6.0). The primary routines I need are
res_init() and res_query(). I started by building the entire BIND tree
which completed fine and it built the libbind.dll, libbind.lib,
libbind.exp, libbind.map, etc.

Now to get my code to compile, I needed to struggle a little and figured
out that I didn't need to #include resolv.h and netdb.h but could just
#include Windows' windows.h and BIND's binwsock.h and that compiled ok.
However, I am currently having problems when linking my code with the
libbind library as per:

      link.exe /DEBUGTYPE:CV /NODEFAULTLIB -debug:full -debugtype:cv
/NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
-subsystem:console,4.0 /out:..\obj\winnt\tests\test.exe
..\obj\winnt\file1.obj ..\obj\winnt\file2.obj ..\obj\winnt\file3.obj
libbind.lib msvcrt.lib oldnames.lib kernel32.lib  ws2_32.lib mswsock.lib
advapi32.lib
file2.obj : error LNK2001: unresolved external symbol _res_init at 0
file2.obj : error LNK2001: unresolved external symbol _res_query at 20
..\obj\winnt\tests\test.exe : fatal error LNK1120: 2 unresolved externals

Now when I do a dumpbin /exports on the libbind.lib that was produced in my
Release directory as part of the BIND build (and which I am linking with
above), I do not see the __res_init and __res_query symbols there. However,
if I run a dumpbin /exports on the libbind.dll that was created at BIND
build time, then those symbols are there.

So my question is - can I get my application to build with the static
libbind.lib by rebuilding the library with some other option (which will
include those missing symbols in the *.lib file) or do I need to use the
libbind.dll to link with my application and if so how would I go about
doing that.

Thanks, Sudhir



More information about the bind-users mailing list