L
Link
Dear,
How is the wonderful PYTHON for me.
It attracts me with its additional variety.
I am developing in C program as well as first to use C++ with extending &
embedding PYTHON.
It seems not to easy. What do I mean?
See that following steps what I am doing.
step 1. Success to make a example.dll with SWIG from MSVC6.0.
After, copy this DLL to C:\Python23\Lib.
step 2. Getting into Pythinwin to run the following commands.
step 3. Making a C file with MSVC6.0 and running.
void main()
{
//initialized the interpreter.
Py_Initialize();
//
int r0 = PyRun_SimpleString("import example\n");
int r1 = PyRun_SimpleString("c = example.new_Circle()\n");
int r2 = PyRun_SimpleString("print c\n");
//destory the interpreter
Py_Finalize();
}
The results:
1. See the step2,
To make a example.dll from MSV6.0 to be called by PYTHON.
Of course, it's OK.
2. See the step3,
while running the statement - 'PyRun_SimpleString("import example\n")'
missing to load the DLL and always return the value r0 = -1,
My quesions are:
1. example.dll can be called on Pythonwin but fail to load by C program.
2. Shall I set the PYTHONPATH while loading the DLL in C program?
If YES, How can I do?
How is the wonderful PYTHON for me.
It attracts me with its additional variety.
I am developing in C program as well as first to use C++ with extending &
embedding PYTHON.
It seems not to easy. What do I mean?
See that following steps what I am doing.
step 1. Success to make a example.dll with SWIG from MSVC6.0.
After, copy this DLL to C:\Python23\Lib.
step 2. Getting into Pythinwin to run the following commands.
step 3. Making a C file with MSVC6.0 and running.
void main()
{
//initialized the interpreter.
Py_Initialize();
//
int r0 = PyRun_SimpleString("import example\n");
int r1 = PyRun_SimpleString("c = example.new_Circle()\n");
int r2 = PyRun_SimpleString("print c\n");
//destory the interpreter
Py_Finalize();
}
The results:
1. See the step2,
To make a example.dll from MSV6.0 to be called by PYTHON.
Of course, it's OK.
2. See the step3,
while running the statement - 'PyRun_SimpleString("import example\n")'
missing to load the DLL and always return the value r0 = -1,
My quesions are:
1. example.dll can be called on Pythonwin but fail to load by C program.
2. Shall I set the PYTHONPATH while loading the DLL in C program?
If YES, How can I do?