Undefined calling conventions in Python.h

Ben Sizer kylotan at gmail.com
Wed Jul 23 08:08:58 EDT 2008


On Jul 23, 11:43 am, Jaco Naude <naude.j... at gmail.com> wrote:
> What Visual C++ is doing is that it is looking for mangled names since
> it does not know the DLL contains C functions. I've managed to work
> around this by declaring the Python functions as follows before using
> them in the C++ application side:
>
> extern "C"
> {
>     void Py_Initialize(void);
>
> }

You should put the extern block around the #include <python.h> call
rather than individual functions, as surely the C calling convention
should apply to everything within.

> It is probably more of a C++ question it turns out, but I would think
> that someone in the Python group would use the Python DLL in C++.

More of a Visual C++ question specifically, since the __clrcall prefix
is a MS specific extension (http://msdn.microsoft.com/en-us/library/
ec7sfckb(VS.80).aspx). If you're not using managed code in your app,
disable it in the project/build options. If you are, then perhaps you
just need to specify that you're not with this DLL, though I've never
had to deal with anything like that myself.

--
Ben Sizer



More information about the Python-list mailing list