From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Subject: finding out if main app is cygwin 16 Nov 1998 22:23:58 -0800 Message-ID: <9811170601.AA25995.cygnus.cygwin32.developers@modi.xraylith.wisc.edu> To: cygwin32-developers AT cygnus DOT com I'm too happy with my current hack of supporting non-cygwin apps loading cygwin DLLs; the hack creates an alternate entry point that you have to specify if the DLL will be loaded by non-cygwin apps. This is troublesome since you'll have to know *how* the DLL was linked. If a Cygwin DLL can somehow figure out (quickly) if the main app is Cygwin, then we can do this via the single entry point without any/much hassle. The DLL startup for non-cygwin apps will still be suboptimal (eg., I don't know if fork works reliably), but at least the same DLL will work for both cygwin and non-cygwin apps. I believe that you can get a handle to the main executable with ``GetModuleHandle (NULL, ...)'', but don't know an easy way to figure out if the app is cygwin from that point on. I remember Chris Faylor working on something similar, so perhaps Chris already has something? I did steal some code from Emacs/NT that did just that (maps the file into memory and looks at dependencies looking for some DLL), but there has to be faster way. Regards, Mumit