Python Forum

Full Version: Embedding Python into a simulator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to embed python in a commercial Discrete Event Simulator (ExtendSim). The simulator offers an extension programming environment which also contains a DLL interface. The simulator is a 64 bit application. My plan is therefore to link to python37.dll, initialize Python and run a function from a python text which is loaded. I managed to get quite far with the initialization part and it seems that the DLL calls work as intended. Still I run into problems with some functions, namely PyTuple_SetItem (used to generate and argument list for the function I want to call) and PyFloat_Check (inserted mainly as a precaution, could be deleted, but should work). The former returns -1, without any obvious reason (the tuple is generated, long enough and I have a pointer which seems valid). The latter crashes the whole simulator (again, the PyFloat is generated and there seems to be a valid pointer). Is there anybody out there with experience from these 'low level' issues? What is wrong and how can it be resolved?