[python-win32] Communicating symbols between extension modules

Jens B. Jorgensen jens.jorgensen at tallan.com
Tue Jan 13 12:30:31 EST 2004


Jack Jansen wrote:

>
> On 13-jan-04, at 10:36, Mark English wrote:
>
>> Hi,
>> I'm still on the beginners slope writing Python extensions, and this may
>> be stuff you already knew, but here's what came to mind:
>> 1) Can't you use "PyImport_ImportModule()" if you need to call python
>> code in another module from C ? Then lookup the appropriate python
>> function object in the module dictionary, and call it ? This should be
>> platform independent if a little clunky (I'm guessing this is what you
>> meant by magic C code).
>
>
> Right. But my problem is that I need to call *C* code from that other 
> module: that code that I want to call is specifically meant to 
> wrap/unwrap C objects from their corresponding Python objects....

So why not just call LoadLibrary/GetProcAddress on the other DLL? 
(Sorry, I skipped some other posts on this thread so if I'm ignoring 
something obvious I apologize.) Windoze is smart enough to see it alreay 
has the other DLL loaded and will just give you the handle to it. Just 
export the C functions you need in that other DLL and off you go.

-- 
Jens B. Jorgensen
jens.jorgensen at tallan.com

"With a focused commitment to our clients and our people, we deliver value through customized technology solutions."




More information about the Python-win32 mailing list