开发者

Tried to embed python in a visual studio 2010 c++ file, exits with code 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 wh开发者_开发问答at 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜