[python-win32] Compiling Python code to DLLs: Any way to do this
Thomas Heller
theller at ctypes.org
Mon Nov 9 08:18:06 CET 2009
Ti Crossman schrieb:
> Hello, all. I have a need to create application extensions for ESRI
> ArcGIS geographic information system software. ArcGIS is built from
> the ground up using COM technology. Supposedly, one can program
> against the (absolutely enormous) ArcObjects object model with any
> COM-compliant language. From what I understand, that includes Python
> -- with the pywin32 extensions, of course. Now, the real trick here
> is that the extension must be compiled into a DLL (and must implement
> the IExension interface) for ArcGIS to recognize it as an extension.
>
> So, making the whopping assumption that I can pull off such a coding
> feat with Python (2.5.1 in this case), I have one main question: is
> there a way to compile my Python code into a DLL that will work for
> me?
When you implement a COM object in Python then it IS a DLL.
If you use pywin32 then it is pythoncom.dll is it, if you
use comtypes then _ctypes.pyd is it. These DLLs have the standard
COM entry points DllGetClassObject and DllCanUnloadNow.
> I did some reading up on py2exe and gather that it will compile
> Pyhton modules to DLLs; however, I also saw a reference to COM DLLs
> vs. C-type DLLs and whether or not they have random entry points.
py2exe can create 'standalone' DLLs from Python COM servers; it can NOT
create DLLs with custom entry points.
--
Thanks,
Thomas
More information about the python-win32
mailing list