Extending python.

  • Thread starter Grzegorz Dostatni
  • Start date
G

Grzegorz Dostatni

Cheers.

More questions.
Let's say I'm trying to extend python with a c module. That module cannot
be dynamically loaded (for reasons outside my control). I have to create a
custom python executable (or more likely custom python library).
How would I do that? Is there documentation on that somewhere? Most of
what I've seen was for dynamic loading.

2nd Step:
Let's say I'm doing it under windows, using Visual Studio. Is there
anything I have to be aware of?

3rd Step:
Let's say I don't have the source available. I do have the object files,
the resulting libraries and the header files though.

Greg

"The optimist proclaims that we live in the best of all possible worlds,
and the pessimist fears this is true."
- James Branch Cabell
 
X

xzm

I think you may create custom python exe... something like the
following and just link against your module and python2x.lib. Of
course, you still need to do the usual stuffs of wrapping around you
own C code. Then you may just 'import xyz' in Python:

#include "Python.h"
#include "xyzmodule.h"

int main(int argc, char **argv)
{
PyImport_AppendInittab("xyz", initxyz);
return Py_Main(argc, argv);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top