Linking problems with BIND8's libbind on Windows.

Sudhir Mohith smohith at us.ibm.com
Tue Aug 26 16:58:22 UTC 2003





In <biegp0$gqh$1 at sf1.isc.org>, Danny Mayer (mayer at gis.net) wrote:

%s> >However, I am currently having problems when linking my code with the
%s> >libbind library as per:
%s> >
%s> >       link.exe /DEBUGTYPE:CV /NODEFAULTLIB -debug:full -debugtype:cv
%s> >/NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
%s> >-subsystem:console,4.0 /out:..\obj\winnt\tests\test.exe
%s> >..\obj\winnt\file1.obj ..\obj\winnt\file2.obj ..\obj\winnt\file3.obj
%s> >libbind.lib msvcrt.lib oldnames.lib kernel32.lib  ws2_32.lib
mswsock.lib
%s> >advapi32.lib
%s> >file2.obj : error LNK2001: unresolved external symbol _res_init at 0
%s> >file2.obj : error LNK2001: unresolved external symbol _res_query at 20
%s> >..\obj\winnt\tests\test.exe : fatal error LNK1120: 2 unresolved
externals

%s> Check libbind.def for the files. __res_init is defined there.
__res_query
%s> is not, at least in 8.3.4 which is the last BIND 8 I built. For some
reason
%s> you don't have an extra underscore ("_") in your file2.c. Make sure you
%s> are using STDC (standard C). You will probably need to add at least
%s> __res_query to libbind.def.

I changed all calls to res_init() and res_query in my file2.c to
_res_init()
and _res_query and the linking is still failing with the same errors. I
have the feeling I am not invoking the link.exe above with the correct
arguments.

The libbind.lib I am using to link is the one I built from the BIND tree
and
which ended up in port/winnt/libbind/Release. I copied that file across to
a
directory which is in my $LIB path. After that failed, I modified the
libbind.def file
in port/winnt/libbind and passed it as /def:libbind.def to link.exe and
that
failed with a larger number of unresolved symbols for symbold defined in
the *.def file
but not in the *.lib file.

What I would have liked to know is that my test.exe depends on file1.c,
file2.c, file3.c, a couple of system libraries and libbind. So how would I
need to modify my Makefile to import the routines from the libbind I built
from the BIND tree? Do I need to use the DLL directly or do I need to pass
a
specific flag to the linker to use the LIB and DEF files and any other
files I
may need.

In other words let's say you wrote some simple code that calls _res_init()
and
_res_query() in my_test.c and you want to link my_test.c with the libbind
libraries that you built separately from the BIND8 distribution (i.e the
port/winnt/libbind) to create my_test.exe, how would you do that in VC++
6.0?

Thanks, Sudhir



More information about the bind-users mailing list