[Winpcap-users] dynamic loading of wpcap.dll

Guy Harris guy at alum.mit.edu
Fri Apr 21 19:42:09 GMT 2006


On Apr 21, 2006, at 11:21 AM, Marcel van Lieshout wrote:

> Question
> Is there a possibility to defer the load of wpcap.dll? Either  
> explicitly ( pcap_Load() )

If it were called pcap_Load(), that'd presumably be in wpcap.dll, and  
it'd be hard to call it without first loading it. :-)

> or implicit at first library-call?

I don't know whether the Windows run-time linker supports that.

The way I know of for doing that sort of thing is to do a LoadLibrary 
() of the library and then call GetProcAddress() to get pointers to  
the functions in the library.  That's how Ethereal does it, for  
example (see capture-wpcap.c in the Ethereal source, although it uses  
GLib's calls for run-time linking rather than directly calling the  
Windows routines).

(This trick probably works on most UN*Xes, too, with the equivalent  
APIs, e.g. dlopen()/dlsym().  OS X is, I think, an exception, as  
dynamically-linked shared libraries and run-time-loaded code modules  
are different.)



More information about the Winpcap-users mailing list