[Python-Dev] Embedding Python when using different calling conventions.
Mark Hammond
mhammond@skippinet.com.au
Sat, 30 Oct 1999 09:11:54 +1000
This is a bit yucky, but still a valid problem.
Malte Kroeger [kroeger@bigfoot.com] recently posted to python-help
with a problem. He has an existing Windows project that he wishes to
use Python in. This project does not use the standard __cdecl calling
convention that Python uses, for various reasons known only to him.
As it is an existing project and quite probably a large, complex one,
I am willing to accept that moving his existing project to match
Python's calling convention is not reasonable. I also feel for him,
as I have personally battled this - both with Python and with other
projects.
He has requested that Python explicitely declare the calling
convention it uses. Thus, it can be embedded in any project.
He wants a new macro. Eg:
DL_IMPORT(int) PyRun_SimpleFile Py_PROTO((FILE *, char *));
becomes
DL_IMPORT(int) CALLCONV PyRun_SimpleFile Py_PROTO((FILE *, char *));
I suggested embedding the calling convention in with the DL_IMPORT
macro, but he pointed out this macro is also used for variables, where
the convention syntax is illegal.
To my mind this is reasonable (maybe not the spelling, but definately
the intent). Any thoughts?
Mark.