Using functions from iphlpapi.dll



I want to use GetNetworkParams() from iphlpapi.dll,
to get dns server IPs.

I'm compiling with Borland 5.5 command-line, and its an app for
wide distribution, hopefully to be used on any
Win32 machine, but Win98 or better would do.

I notice on MSDN it says :

//
// Link with IPHlpAPI.lib
//

in the example code for GetNetworkParams()

Why do I get a linker error ?
Ive included iphlpapi.h, and have iphlpapi.lib in
c:\borland\bcc55\lib\psdk


thanks !
nicklyonsAsked:
Who is Participating?
 
CayceConnect With a Mentor Commented:
Sorry,

do an IMPLIB to the DLL, that will generate a .LIB file, this can be linked in your executable using the command line tools.
0
 
George TokasCommented:
try the usual way:
LoadLibrary() and  after GetProcAddress().

gtokas.
0
 
nicklyonsAuthor Commented:
thanks, although I already got there....

why is it different for this DLL ? You dont need to do this for say, Registry functions from advapi.dll

N
0
 
CayceCommented:
Do and implib to the DLL, then link the .lib to your executable file.
0
 
CayceCommented:
No objections on my part.

The complete answer would have been:

Add the iphlpapi.lib on the linker's command line, so it would get linked.
If iphlpapi.lib was no available or incompatible (VC++ .lib files are not compatible with borland tools), just use the implib.exe tool to generate the iphlpapi.lib file.

If you would want dynamic linking, using LoadLibrary() and GetProcAddress() (as gotkas stated above) would be the way, to go. No need to modify the linker's command line (the author is using borland command line tools) or the makefile.

Cayce
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.