Creating C modules for Python under Cygwin

Alex Martelli aleax at aleax.it
Mon May 6 03:44:06 EDT 2002


Martin v. Loewis wrote:

> Alex Martelli <aleax at aleax.it> writes:
> 
>> Yes, that's good motivation -- any EXE needs a further process
> 
> Now I wonder if this is fact: Are you sure you cannot LoadLibrary a .exe?

LoadLibrary used to be specified to work only for DLL's , but that changed
in reasonably recent platform SDK's -- now the docs do say "executable 
module (either a .dll or .exe file)", *BUT*.  The results of LoadLibrary
applied to an .exe CANNOT be used (according to the docs: there is AFAIK
no guarantee that it may not happen to 'work by accident' in any one
specific case) to RUN code in an exe.  I quote:
"""
LoadLibrary can also be used to map other executable modules. For example, 
the function can specify an .exe file to get a handle that can be used in 
FindResource or LoadResource. However, do not use LoadLibrary to run an 
.exe file, use the CreateProcess function.
"""

The specs of LoadLibraryEx are somewhat murkier, but I read them as not
reliably allowing "running code" within the EXE either.


Alex




More information about the Python-list mailing list