views:

332

answers:

1

I am currently working on a Cygwin/GCC application written in C++. The application requires embedding of python to run plug-ins, I've successfully embedded using the Cygwin python libraries and was able to run simple python files as part of the program. However, the python files now require the use of a windows GUI framework (wxPython), and so I need to be able to embed the Windows Python environment, otherwise I cannot use the framework in the python files. In an attempt to do this, I created libpython25.a using step 2 of these instructions. I then used the library/header files of the windows installation to compile it. However, when I run it the program crashes with some strange debugger output (debug info is on, strangely enough).

gdb: unknown target exception 0xc0000008 at 0x77139a13
Program received signal ?, Unknown signal.
[Switching to thread 2216.0x119c]
0x77139a13 in ntdll!RtlLockMemoryZone () from /cygdrive/c/Windows/system32/ntdll.dll
(gdb) where
#0  0x77139a13 in ntdll!RtlLockMemoryZone () from /cygdrive/c/Windows/system32/ntdll.dll
#1  0x030c1c7c in ?? ()
#2  0x030c1c80 in ?? ()
#3  0x1e0d0e80 in python25!_PyTime_DoubleToTimet ()
   from /cygdrive/c/Windows/SysWOW64/python25.dll
#4  0x00000000 in ?? ()'

If anyone has done this successfully, I would greatly appreciate the help. Is embedding Windows python in a Cygwin/GCC program possible? If not what are my other options? (Right now I can only think of moving over to VC++ but this would be pretty drastic, also I do not want to use X11 for the GUI).

A: 

Not a direct answer, but you could split the system into 2 processes - the Cygwin one (Python & C++, no wxPython) and the win32 one (Python & wxPython) and communicate between them with RPyC, XML-RPC, etc.

orip
hm... not bad. Looking at RPyC, it seems as though we would write Python code on the Cygwin side that handles the communication between the program and the separate plug-in processes. Our app is already multi-threaded, so I guess we can extend it to be multi-process. Thanks for the suggestion, seems quite complex, but it's the best idea so far. I'll need to look into it further.
Ben M