Solved

Using functions from iphlpapi.dll

Posted on 2004-07-30
7
9,639 Views
Last Modified: 2013-11-17


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 !
0
Comment
Question by:nicklyons
  • 3
7 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 11689531
try the usual way:
LoadLibrary() and  after GetProcAddress().

gtokas.
0
 

Author Comment

by:nicklyons
ID: 11689703
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
 
LVL 9

Expert Comment

by:Cayce
ID: 11694649
Do and implib to the DLL, then link the .lib to your executable file.
0
 
LVL 9

Accepted Solution

by:
Cayce earned 125 total points
ID: 11694659
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
 
LVL 9

Expert Comment

by:Cayce
ID: 12449194
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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now