[Winpcap-users] library calling convention

Gianluca Varenni Gianluca.Varenni at riverbed.com
Mon Jan 31 08:49:09 PST 2011

Windows actually supports 3 calling conventions for C code: cdecl, stdcall and fastcall. The one used by WinPcap is _cdecl.

Have  a nice day

-----Original Message-----
From: winpcap-users-bounces at winpcap.org [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Chris Morgan
Sent: Friday, January 28, 2011 7:29 AM
To: winpcap-users at winpcap.org
Subject: [Winpcap-users] library calling convention


I'm the developer of sharppcap, a .net wrapper to libpcap/winpcap.

One user has reported seeing issues when calling any winpcap functions. The error points to an issue on the sharppcap side related to the calling convention being used. I can't reproduce these issues here.

Currently the calling convention of the pcap_dispatch() callback is flagged as cdecl but I don't believe I've specified the same on the rest of the api. The user also says that specifying cdecl for all functions resolves the issue, a PInvokeStackImbalance exception.

While it was my understanding that windows api used stdcall, linux uses cdecl, I can't figure out how to determine the calling convention used by winpcap functions and was hoping someone could help to fill in the blanks. The other interesting question that I have is why I'm not seeing any issues with Win7 64bit, not sure what specific os configuration this user is using.

Winpcap-users mailing list
Winpcap-users at winpcap.org

More information about the Winpcap-users mailing list