[Winpcap-users] Unexpected C++ name mangling of pcap entrypoints with MSVC++ 2005

Kevin Miles kevin.miles at delgaldo.co.uk
Tue Aug 21 17:15:02 GMT 2007


Hi,

I'm using winpcap 4.1 with MSVC++ 2005 and all references to pcap
entrypoints declared in pcap.h get (slightly) mangled by having an
underscore pre-pended to them, resulting in linker errors of the form:

CaptureFile.obj : error LNK2019: unresolved external symbol _pcap_next_ex
referenced in function "public: __thiscall CaptureFile::CaptureFile(char *)"
(??0CaptureFile@@QAE at PAD@Z)

The IDE indicates that __cplusplus is defined and that the extern "C" block
in pcap.h *is* being processed so I'm at a loss to understand why the names
are being mangled at all. I've tried telling the IDE to use __stdcall
instead of __cdecl, but that just adds the parameter count as further
decoration. I've also tried surrounding my #include pcap.h with extern "C"
{}, but that generates the compile-time error:

c:\program files\microsoft platform sdk for windows server 2003
r2\include\wspiapi.h(44) : error C2894: templates cannot be declared to have
'C' linkage

I've now run out of ideas. There must be someone who is successfully calling
winpcap from MSVC++. Perhaps you would be kind enough to share the secret
with me.

Many thanks,
Kevin.



More information about the Winpcap-users mailing list