Extending and Embedding

Eduardo Rodrigues little_bode at yahoo.com.br
Sun Mar 13 22:56:32 CET 2005


Sorry, I guess that I wasn't clear. I've made a module
using swig that wrap functions written in C. If I load
that module in python using:

>>> from <module> import *

it works fine. But if I execute this same command
using PyRun_SimpleString in another code written in C,
it doesn't work, i.e. I can't load a module (made by
swig) in a embedding code.

Erocha

--- "Diez B. Roggisch" <deetsNOSPAM at web.de> wrote:
> Eduardo Rodrigues wrote:
> 
> > How can I load a module (written in C as a shared
> > library (.so)) through "PyRun_SimpleString"?
> > 
> > I've tried "from <module> import *", but a got a
> > message: ImportError: No module named <module>
> 
> You can't do this. You have to either wrap the
> module - which is possible in
> several ways, including hand-written code, pyrex,
> swig and sip. Maybe even
> more, I don't know. 
> 
> Or you access it using the module ctypes that allows
> to invoke arbitrary
> methods/funtctions of C-libs. google for it.
> -- 
> Regards,
> 
> Diez B. Roggisch
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


	
	
		
Yahoo! Mail - Com 250MB de espaço. Abra sua conta! http://mail.yahoo.com.br/



More information about the Python-list mailing list