Can embedded static-linked python still import dll extensions?
jcw at equi4.com
Tue Mar 14 18:50:17 CET 2000
Warren Postma wrote:
> I recompiled the Python sources for Windows with config.h and put this
> line in:
> #define MS_NO_COREDLL 1 // build a static library not a DLL!
> Now it statically links fine, but it doesn't allow me to import .pyd
> files (Python extension DLLs). [...]
> I want my embedded python deeply embedded but I still want to produce
> .PYD style add ons for the system once it's in the field. Am I stuck?
Eh... yes you are. This is one of the reasons why Tcl adopted "stubs",
which is simply a vector pointing to all Tcl core routine, handed to the
extension at initialization time so it doesn't need DLL linkage *back*
into the interpreter. Scriptics has embraced and extended stubs (ahem),
and now calls is TEA, the Tcl Extension Architecture.
No rocket science (MacOS does it, COM does it, and many others), but it
won't be doable for Python without a change: extensions don't get any
info passed into them at initialization time, so there's no way to make
this happen without altering the extension API (slightly). That could
be done without breaking anything, by adding a second init entry point.
It would be a very useful change, it simplifies versioning, as well as
path search conflicts, and it lets you create standalone executables
which are still dynamically extensible (actually, they are today, on
Solaris/Linux, but not Windows). It's one of the main reasons why I
keep using Tcl (the other is Tk).
More information about the Python-list