Requirements for UDNS Install

Michael Tokarev mjt at corpit.ru
Fri Dec 2 23:40:00 MSK 2005


T kyer wrote:
> Hi Michael
> 
> Thanks for your prompt reply. Library packages of the
> quality offered by UDNS are rare for C/C++ internet
> Libraries. It would be worth the effort to work together to
> try to port this excellent package to windows. I may not
> respond to queries immediately but I will provide feedback
> in short order. 
> 
> Actually I'm glad that to try to port UDNS to a Gcc
> compiler instead of MS Visual C++. The reason being is that
> Visual C++ is a non standard C++ compiler. Usually what
> this means is that is that any software built with this
> compiler can only be built with Visual C++ and nothing else
> unless extensive changes are implemented. With Gcc on the
> other hand this is not usually the case.
> 
> I'm not sure what you mean by compile natively. Could you
> please elaborate.

I mean MSVC, which is THE compiler for windows platform (ie,
the compiler used to build windows itself).

> I don't think these functions are available - getopt() and
> inet_ntoa() and friends - unless they are included in one
> of the library files. This is not easily verifiable unless
> you have a package name e.g. winsock.h or libwininet.a. No
> matter, once we know which external files are required we
> will be able to sort this out.

I'll upload the files with inet_ntoa() and getopt(). The
rest -

> Following please find the compiled error list:
> 
> Compiler: Default compiler
> Executing  make...
> make.exe -f "Makefile" all

Can you please use -k switch next time, so that `make'
will show any errors in *all* files, instead of stopping
at first one?

> gcc -Wall -W -Wmissing-prototypes -O2 -DHAVE_POLL -c
> udns_dn.c gcc -Wall -W -Wmissing-prototypes -O2 -DHAVE_POLL

Hmm.  The Makefile provided should NOT work on windows, even
with gcc-based build environment.  It's rather unix-specific.
Also, I doubt windows (or, rather, "unix emulation layer"
provided by gcc libraries) includes poll() -- -DHAVE_POLL should
not be used here (but see below for HAVE_POLL).

> -c udns_dntosp.c gcc -Wall -W -Wmissing-prototypes -O2
> -DHAVE_POLL -c udns_parse.c gcc -Wall -W
> -Wmissing-prototypes -O2 -DHAVE_POLL -c udns_resolver.c
> udns_resolver.c: In function `dns_add_serv_internal':
> udns_resolver.c:258: error: `EOVERFLOW' undeclared (first
> use in this function)

Aha.  Well.  I'd change this error code to, say, ENFILE, which
is available in windows's errno.h (in 3 places where it's used).

[]
> udns_resolver.c: In function `dns_initns_iphlpapi':
> udns_resolver.c:457: error: `PIP_ADAPTER_ADDRESSES' undeclared
> udns_resolver.c:458: error: `PIP_ADAPTER_DNS_SERVER_ADDRESS' undeclared
> udns_resolver.c:464: error: `HANDLE_ERROR' undeclared
> udns_resolver.c:470: warning: implicit declaration of function `GetAdAddrs'

This is a functionality available on WindowsNT line (w2k, wxp etc).
It will not work on win9x.  Is there a way to determine, using
preprocessor directives, whenever it's available in current
environment or not?  Maybe by using WINVER?  Looks like I should
examine header files from WinNT more closely...  I wonder where
I can find those headers? :)  I've pretty old version of watcom
C++ compiler (which is dead long time since), which comes with
windows headers, but the said headers does not cover this iphlp
API either.

Ok.  Looks like you should find more recent windows headers... ;)
I looked at the code in udns_resolver - it tries to load a DLL
at runtime and use it *if* it's available. If not, the code will
fall back to old methods.  So, the code is portable, the only
thing needed is to find the proper definitions (.h files) for
that stuff... Maybe iphlpapi.h? ;)

> udns_resolver.c: In function `dns_initns_registry':
> udns_resolver.c:510: warning: passing arg 4 of `RegQueryValueExA' from incompatible pointer type
> udns_resolver.c:510: warning: passing arg 5 of `RegQueryValueExA' from incompatible pointer type
> udns_resolver.c:510: error: too few arguments to function `RegQueryValueExA'

Wooh.  Missing NULL as a 3rd argument, like in another call
to the same function 3 lines above this one.  Ok.

> udns_resolver.c: In function `dns_close':
> udns_resolver.c:754: warning: implicit declaration of function `close'

This should be closesocket(), not close().  Ok.

> udns_resolver.c: In function `dns_ioevent':
> udns_resolver.c:1254:3: warning: #warning fixme: poll()/select() on WIN32 (WaitForMultipleObjects?)

Ok, looks like select() is the right mechanism to use here.
Ok.  So for win32, I will just use select unconditionally,
#undef'ining HAVE_POLL if it's defined.

> udns_resolver.c: In function `dns_resolve':
> udns_resolver.c:1257: error: storage size of 'pfd' isn't
> known udns_resolver.c:1283: error: `POLLIN' undeclared
> (first use in this function) udns_resolver.c:1291: warning:
> implicit declaration of function `poll'
> udns_resolver.c:1257: warning: unused variable `pfd'

All this will go away after the previous change.

> udns_resolver.c: At top level: udns_resolver.c:395:
> warning: 'dns_set_srch_internal' defined but not used

Heh.  Ok.  On unix platform, typical DNS configuration
is in /etc/resolv.conf file.  On win*, it's hardly possible
to determine the list of nameservers to use, but how about
domain search list? ;)  I'll ignore this warning for now,
at least until all the stuff with nameservers will be
sorted out.

> make.exe: *** [udns_resolver.o] Error 1 Execution
> terminated
> 
> Please let me know your thoughts

I'll make some files available at http://www.corpit.ru/mjt/udns/win/
a bit later today or tomorrow.  Let's see how it'll go... ;)

/mjt


More information about the udns mailing list