Re: ctypes.CDLL("") fails on MS Windows [SEC=PERSONAL]

"Andrew MacIntyre" <[email protected]> Wed, 4 Jan 2012 07:58:26 +0000
Newsgroups gmane.comp.python.ctypes
Message-ID <A1E4E9D08D14924498E135FB4441EE8D18FE69E2@act01exmbx01vp.internal.govt>
> From: Jacob Schmidt
> 
> On Windows, you can use something like this:
> > exe = ctypes.CDLL("myprocess",
> >                     ctypes.windll.kernel32.GetModuleHandleA(None))
> >
> > to get the current process.  However, I'm not sure if this makes
> > sense:  an exe cannot export functions.
> 
> Where did you hear that from Thomas? The PE format applies to both exe
> and dlls, both can import and export functions.

True, but the exports are explicit and have to be defined at link time - not automatic the way they are on Unix-like OSes, which makes them less useful in general (most exes are linked without any exported functions).

-------------------------> "These thoughts are mine alone!" <---------
Andrew MacIntyre           Operations Branch
tel:   +61 2 6219 5356     Communications Infrastructure Division
fax:   +61 2 6253 3277     Australian Communications & Media Authority
email: [email protected]            http://www.acma.gov.au/


NOTICE: This email message is for the sole use of the intended recipient(s) 
 and may contain confidential and privileged information. Any unauthorized 
 review, use, disclosure or distribution is prohibited. If you are not the 
 intended recipient, please contact the sender by reply email and destroy all 
 copies of the original message.

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox