Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Extending python.

Reply
Thread Tools

Extending python.

 
 
Grzegorz Dostatni
Guest
Posts: n/a
 
      08-06-2004

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


 
Reply With Quote
 
 
 
 
xzm
Guest
Posts: n/a
 
      08-07-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 <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extending the reception of a network yar Wireless Networking 3 06-15-2005 05:16 PM
extending a wireless Stuart Turrell Wireless Networking 6 11-30-2004 10:18 PM
Extending a Vlan Dak991 Cisco 1 11-23-2004 06:48 PM
Extending console cable Stibloc Cisco 3 02-29-2004 02:34 AM
Extending a T1 over Ethernet / Fiber link Rick G Cisco 2 07-11-2003 09:22 PM



Advertisments