OSDN Git Service

* how-programming.texinfo: Add "How do I load cygwin1.dll dynamically from a
authorcgf <cgf>
Sat, 4 Jun 2005 02:14:13 +0000 (02:14 +0000)
committercgf <cgf>
Sat, 4 Jun 2005 02:14:13 +0000 (02:14 +0000)
Visual Studio or MinGW application?"

winsup/doc/ChangeLog
winsup/doc/how-programming.texinfo

index e9b4607..0a14adf 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-03  Max Kaehn <slothman@electric-cloud.com>
+
+       * how-programming.texinfo: Add "How do I load cygwin1.dll dynamically
+       from a Visual Studio or MinGW application?"
+
 2005-05-28  Joshua Daniel Franklin  <joshuadfranklin@yahoo.com>
 
        * how-using.texinfo : Update the mkdir -p section to reflect 
index 3003ff7..ae233cf 100644 (file)
@@ -269,6 +269,22 @@ then generate import libraries for the MS VC linker.
 Thanks to Alastair Growcott (alastair dot growcott at bakbone dot co
 dot uk) for this tip.
 
+@subsection How do I load @samp{cygwin1.dll} dynamically from a Visual Studio or MinGW application?
+
+Read @code{how-cygtls-works.txt} and the sample code in
+@code{winsup/testsuite/cygload} if you want to understand how this works.
+The short version is:
+
+@enumerate
+@item Make sure you have 4K of scratch space at the bottom of your stack.
+@item Invoke @code{cygwin_dll_init()}:
+@example
+HMODULE h = LoadLibrary("cygwin1.dll");
+void (*init)() = GetProcAddress(h, "cygwin_dll_init");
+init();
+@end example
+@end enumerate
+
 @subsection How do I link against a @samp{.lib} file?
 
 If your @samp{.lib} file is a normal static or import library with