[Winpcap-users] Problems with Tutorial "Filtering the traffic"

Guy Harris guy at alum.mit.edu
Wed Mar 15 20:55:54 GMT 2006


Gianluca Varenni wrote:
> Uhm, the error tells me you are writing a managed c++ application (BTW, 
> a managed C++ MFC application, quite interesting).
>  
> I suggest you to read this FAQ
>  
> http://www.winpcap.org/misc/faq.htm#Q-29

	...

> The problem is due to the fact that the standard winpcap include file
> "pcap.h" contains only a forward declaration of "struct pcap", but not
 > the actual definition of it. As a consequence, the Managed C++
 > compiler does not emit any metadata for that type, since there's no
 > definition for it.
> 
> There are two solutions to the problem:
> 
 >
>     1. Include "pcap-int.h" instead of "pcap.h". This include the
 >        actual definition for the type "struct pcap"
 >
>     2. Add a fake definition of "struct pcap". The simplest one is
 >        "struct pcap{};".

Managed C++ requires extra work for opaque structures?  Sigh....

Is there some sort of #ifdef so that pcap.h could do "struct pcap{};" in 
Managed C++ and "struct pcap;" in C and "unmanaged" C++?  (Does C++ 
support opaque structures in that fashion?  If so, why doesn't Managed 
C++ do so?  "We don't care, we don't have to - we're Microsoft"?)



More information about the Winpcap-users mailing list