Undefined calling conventions in Python.h

Jaco Naude naude.jaco at gmail.com
Wed Jul 23 05:58:42 EDT 2008


On Jul 23, 9:59 am, Fredrik Lundh <fred... at pythonware.com> wrote:
> Jaco Naude wrote:
> > 1>application.obj : error LNK2031: unable to generate p/invoke for
> > "extern "C" void __clrcall Py_Exit(int)" (?Py_Exit@@$$J0YMXH at Z);
> > calling convention missing in metadata
> > 1>frmPythonInterface.obj : error LNK2031: unable to generate p/invoke
> > for "extern "C" void __clrcall Py_Exit(int)" (?Py_Exit@@$$J0YMXH at Z);
> > calling convention missing in metadata
>
> > I'm probably missing something but I can't find any calling convention
> > details in Python.h or the other headers included in this file.
>
> the precence of name mangling indicates that your compiler doesn't
> understand that Python's a C library, and therefore uses C calling
> conventions.  have you managed to override the defaults in some odd
> way?
>
> </F>

good point. I agree that the problem is probably due to name mangling.
I'm not sure how its possible to tell the application that the DLL is
a C dll? I've looked at the DLL using Dependency Walker and the
functions in the DLL are clean (Thus no name mangling used).

How do I tell Visual C++ that the DLL is a C dll? I thought it should
be in Python.h but this line appears at the top of the file:

/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern
"C" { */

Thanks for the help
Jaco





More information about the Python-list mailing list