Extending python.

xzm xing_zhimeng at yahoo.com
Sat Aug 7 06:06:07 EDT 2004


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);
}



Grzegorz Dostatni <grzegorz at ee.ualberta.ca> wrote in message news:<Pine.LNX.4.44.0408061224090.8941-100000 at e5-05.ee.ualberta.ca>...
> 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



More information about the Python-list mailing list