I see a couple of problems. First, because I'm using Unix, where filenames are
case-sensitive, I had to '#include "Python.h"' instead of '#include
"python.h"'.
Next, it looks like the behavior that '.' is placed on sys.path isn't done
automatically when embedding. So I had to set the environment
[EMAIL PROTECTED] wrote:
> Program crashes at line Py_Finalize(). Program tries to read some
>memory location and suffer run time exception.
PyTuple_SetItem "steals" a reference, so changing
Py_XDECREF(stringarg);
Py_XDECREF(args);
to just
Py_XDECREF(args);
might fix the problem.
well I manage to figure it out myself. I'm using Bloodshed Dev-cpp
Here's the code:
#include "python.h"
#include
int main(int argc, char* argv[])
{
double answer = 0;
PyObject *modname, *mod, *mdict, *func, *stringarg, *args, *rslt;
Py_Initialize();
modname = PyStri