[Python-bugs-list] [ python-Bugs-471432 ] __cdecl / __stdcall unspecified in *.h

noreply@sourceforge.net noreply@sourceforge.net
Mon, 15 Oct 2001 12:19:00 -0700


Bugs item #471432, was opened at 2001-10-15 12:18
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=471432&group_id=5470

Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Frederic Giacometti (giacometti)
Assigned to: Tim Peters (tim_one)
Summary: __cdecl / __stdcall unspecified in *.h

Initial Comment:

Currently, the win32 function call convention
(__stdcall vs __cdecl)  is never specified in the
function prototypes contained in the .h header files.

The call convention is therefore left up to the
configuration of the compiler incluing the header files
(__cdecl by default on VC++).

However, there are situations in which the compiler
default call convention must be set to __stdcall (/Gz
option on VC++'s cl.exe), and this makes the link fail;
until __cdecl keywords are manually insterted in the
Python.h function prototypes required for linking.

[For instance, /Gz is required when using typedef
definitions on function pointers, later passed as
arguments on __stdcall functions (the default on
Microsoft/commercial libraries)].

Besides, Microsoft recommands, it the VC++
documentation,  that the __stdcall convention be used
by default for function with fixed numbers of arguments
(smaller code size and better performances); __cdecl
being limited for use with functions with variable
number of args ('...').

A solution would consist in defining:
#ifdef _MS_VER
#define FIXARGCALL __stdcall
#define VARARGCALL __cdecl
#else
...
#endif

and sticking FIXARGCALL / VARARGCALL in front of all
DLL_IMPORT(), macro calls associated to a an exported
function prototype, across all Python .h files.

Frederic Giacometti


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=471432&group_id=5470