[Winpcap-users] wpcap.lib_console_or_windows_form_application

Bryan Kadzban bryan at kadzban.is-a-geek.net
Thu Feb 21 03:17:52 GMT 2008

Hash: RIPEMD160

j j wrote:
> Is wpcap.lib relevant for (Microsoft Visual C++ 2008) windows form 
> applications ?

You need it when you write any C or C++ program on Windows that early
binds (or "explicitly links"; the term used for this action varies) to
wpcap.dll.  Whether the program is for the console or for winforms is
irrelevant -- if it early-binds to wpcap.dll, then you need to use
wpcap.lib at compile time.

(Otherwise, you get link errors when the linker can't find the mangled
names for the functions exported from wpcap.dll.  Because the headers
create references to mangled names (underscore prepended, and some
random characters including @ appended); the .lib file is what resolves
these to the real, unmangled names that are exported from the DLL.)

Alternately, I think you can call the wpcap.dll functions from managed
code using the DllImportAttribute, but that's late binding.  In that
case, the runtime is calling LoadLibrary and GetProcAddress for you, and
it's calling GetProcAddress on the unmangled name (which will succeed).

Of course, this applies to *any* (non-.Net) DLL used from C or C++, not
just wpcap...
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Winpcap-users mailing list