DLL/Embeded interpreter wierdness

David Bolen db3l at fitlinxx.com
Mon Feb 25 23:25:09 EST 2002


Courageous <jkraska at san.rr.com> writes:

> So. Let me see if I can phrase this right:
> 
> If I have an embedded interpreter sitting in a .dll and this
> self-same dll wants to be a module for import in scripts
> executed by the embedded interpreter, will this work?

Typically when I've done this (both embedded and extended in the same
DLL or executable), what I've done is automatically define my module
internally before calling out to the embedded interpreter.  The
differences between initialization in the two cases are very slight.

That way, if the embedded interpreter does do an "import xxxx" the
module will already be available and it won't try to load me again.
To the embedded code, the module appears as a built-in module.

Thus you can write scripts that use "import xxxx" and will resolve the
module properly whether started as an embedded script, or run to use
the module as an extension module.

Actually, in many cases, I execute the "import xxxx" automatically on
behalf of the embedded script before running it just to make it
simpler for the script writers (since the embedded cases are normally
simple extension scripts), but that's just a nicety.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list