How can load dll in C?
link0937 at hotmail.com
Tue Sep 23 03:55:16 CEST 2003
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 &
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.
>>> import example
>>> c = example.new_Circle()
>>> print c
step 3. Making a C file with MSVC6.0 and running.
//initialized the interpreter.
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
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?
More information about the Python-list