mturk/cygspawn — Issue #1: Dynamically loading cygwin1.dll to automatically find cygroot, etc
Author: Juntalis
Created: 2012-01-20 00:05:05+00:00
State: open

Hey,

I'm currently working on a win32 (vc) port of the ln utility that creates native ntfs hard links/symbolic links/etc. Anyways, one of the features I wrote in was that if it detected that it was run from cygwin/msys, and if the paths given were POSIX-style paths, it will LoadLibraryW(L"cygwin1.dll") (or in MSYS, msys-1.0.dll) and call the appropriate functions to accurately convert the path in the context of the current environment. Since the program is being run from cygwin, you can rightfully assume that cygwin1.dll will be on the system PATH, and thus be accessible from the program. That should eliminate the need for users to have to set the CYGROOT environment variable, or specify it on the command line.

If you're interested, I can clean up the code a bit and throw it in a pull request. I'm just not sure if you're manually converting the paths for the sake of performance, since dynamically loading the cygwin dll also requires you call cygwin_dll_init. (I can probably do a quick benchmark if that's the case)