[Tutor] converting a source package into a dll/shared library?

Alan Gauld alan.gauld at btinternet.com
Tue Aug 14 18:15:32 CEST 2007


"Duncan Gibson" <duncan at thermal.esa.int> wrote

> Is it possible to convert a Python package, with __init__.py and
> related python modules, into a single DLL or shared library that can
> be imported in the same way?

Since you refer to DLLs I'll assume a Windoze platform.
If so the answer is yes you can create an ActiveX/COM object.

So if its accessibility to non Python code you are interested
in grab a copy of Mark Hammonds Win32 book for details
and examples. You can even go DCOM if thats significant.

OTOH If its code obfuscation that worries you then Kent's
suggestion of distributing the .pyc files is probably the best
you can do.

(Gordon MacMillan's installer may be able to build DLLs
I'm not sure...)

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld






More information about the Tutor mailing list