1

I am trying to embed some python code in a c++ application i am developing with ms visual studio c++ 2010. But when i run the program, it exits with code 0x01 when i call Py_initialize().

I dont know how to find out what went wrong. the help file says, Py_Initialize can't return an error value, it only fails fataly. But, why did it fail?

I am using a self-compiled python27_d.dll, which i created with the msvs project files in the source downloads from python.org.

Amro
  • 123,847
  • 25
  • 243
  • 454
lomex
  • 11
  • 3
  • Please show your code. Did you also compiled the python dll with VC10? – wkl Nov 18 '10 at 16:26
  • jep, i did. the code doesnt matter, the problem occurs even with only "Py_Initialize();" in the main function. – lomex Nov 25 '10 at 12:49

2 Answers2

0

Is there simple 'hello world' type example of the Py_Initilize code in the python sdk you can start with?

That will at least tell you if you have the compiler environment setup correctly, or if the error is in your usage.

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
0

Well, i finally found out what went wrong. I did compile my python27_d.dll with the same VC10 as my program itself. But my program is normally compiled as 64 bit executable. I just forgot to compile the dll for x64, too. I didnt think this would lead to such annoying behavoiur, as i believed i would get a linkr error then.

lomex
  • 11
  • 3