Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-06-04 06:14:13 +0400
committerChristopher Faylor <me@cgf.cx>2005-06-04 06:14:13 +0400
commit909df7cbb423c5a02c33544c0d77a337b6258f1e (patch)
tree0746172be13ae58f5e40f29f01fb00b05dac7361 /winsup/doc/how-programming.texinfo
parent6e780c8bf5805e72414adad805f40ef4df1ebf57 (diff)
* how-programming.texinfo: Add "How do I load cygwin1.dll dynamically from a
Visual Studio or MinGW application?"
Diffstat (limited to 'winsup/doc/how-programming.texinfo')
-rw-r--r--winsup/doc/how-programming.texinfo16
1 files changed, 16 insertions, 0 deletions
diff --git a/winsup/doc/how-programming.texinfo b/winsup/doc/how-programming.texinfo
index 3003ff7c3..ae233cfbd 100644
--- a/winsup/doc/how-programming.texinfo
+++ b/winsup/doc/how-programming.texinfo
@@ -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