Re: Undefined calling conventions in Python.h

2008-07-25 Thread Fredrik Lundh
Ben Sizer wrote: In theory, yeah. In practice, if his compiler was somehow not respecting that, then a quicker fix is to enclose the #include than to do individual prototypes. Admittedly that might obscure the problem rather than solve it. Well, I'd say that the should in You should put the

Re: Undefined calling conventions in Python.h

2008-07-25 Thread Ben Sizer
On Jul 23, 1:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Ben Sizer wrote: > > You should put the extern block around the #include call > > rather than individual functions, as surely the C calling convention > > should apply to everything within. > > Hello?  Python's include files are C++ sa

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Martin v. Löwis
> 1>application.obj : error LNK2031: unable to generate p/invoke for > "extern "C" void __clrcall Py_Exit(int)" (?Py_Exit@@[EMAIL PROTECTED]); > calling convention missing in metadata The main problem here is the __clrcall hint: apparently, you are using Managed C++ resp. C++/CLI, i.e. the Microso

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: Fredrik, thanks for the help. I'm not sure why but it seems to work now even if I don't include the extern "C" command. It also works with both Python.h files (after I copied pyconfig.h from the PC folder). So it seems like everything is working now. As it's supposed to do.

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 2:08 pm, Ben Sizer <[EMAIL PROTECTED]> wrote: > On Jul 23, 11:43 am, Jaco Naude <[EMAIL PROTECTED]> 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

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Ben Sizer wrote: You should put the extern block around the #include call rather than individual functions, as surely the C calling convention should apply to everything within. Hello? Python's include files are C++ safe. I even posted a complete compiler session to show that I'm not makin

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Ben Sizer
On Jul 23, 11:43 am, Jaco Naude <[EMAIL PROTECTED]> 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++ applica

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 1:50 pm, Jaco Naude <[EMAIL PROTECTED]> wrote: > On Jul 23, 1:10 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > Jaco Naude 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

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: That said, let me double check something which might be causing problems since you will be familiar with this. Which Python.h file do you include when including the DLL in your programs? The one in the source distribution of the one in the installation distribution? I've been i

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 1:10 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Jaco Naude 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 usi

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Fredrik Lundh wrote: > cl cl -EHsc -MD -I \python25\include test.cc \python25\libs\python25.lib cut and paste error there: the "cl cl" should be just one "cl", of course. and just for the record/google, if I 1) don't include the header file, I get test.cc(5) : error C3861: 'Py_Initialize':

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude 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_Initializ

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 12:16 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Jaco Naude wrote: > > 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

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: 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

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
On Jul 23, 9:59 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Jaco Naude wrote: > > 1>application.obj : error LNK2031: unable to generate p/invoke for > > "extern "C" void __clrcall Py_Exit(int)" (?Py_Exit@@[EMAIL PROTECTED]); > > calling convention missing in metadata > > 1>frmPythonInterface.obj

Re: Undefined calling conventions in Python.h

2008-07-23 Thread Fredrik Lundh
Jaco Naude wrote: 1>application.obj : error LNK2031: unable to generate p/invoke for "extern "C" void __clrcall Py_Exit(int)" (?Py_Exit@@[EMAIL PROTECTED]); calling convention missing in metadata 1>frmPythonInterface.obj : error LNK2031: unable to generate p/invoke for "extern "C" void __clrcall

Undefined calling conventions in Python.h

2008-07-23 Thread Jaco Naude
Hi there, This is my first post over here and I hope someone can give me some guidance. I'm trying to embed Python into a Visual C++ 2008 application and I'm getting linker problems. I've compiled a DLL of the Python source code using the pythoncode VC++ project in the PCbuild folder of the sourc