diff options
author | Joshua Daniel Franklin <joshuadfranklin@yahoo.com> | 2004-06-15 03:19:23 +0000 |
---|---|---|
committer | Joshua Daniel Franklin <joshuadfranklin@yahoo.com> | 2004-06-15 03:19:23 +0000 |
commit | e52db4e16dcbdfa7cbfb7e6e460e0fef88f35bd3 (patch) | |
tree | c6f8a5b0330a4a12aea40b141ff4098daf59afe5 | |
parent | 64b49cceb50bbac54177ffeb120a64092de90f75 (diff) | |
download | newlib-e52db4e16dcbdfa7cbfb7e6e460e0fef88f35bd3.zip newlib-e52db4e16dcbdfa7cbfb7e6e460e0fef88f35bd3.tar.gz newlib-e52db4e16dcbdfa7cbfb7e6e460e0fef88f35bd3.tar.bz2 |
* how-programming.texinfo: Add section about Visual Studio linking.
-rw-r--r-- | winsup/doc/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/doc/how-programming.texinfo | 60 |
2 files changed, 64 insertions, 2 deletions
diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog index 2af48e5..4f2b897 100644 --- a/winsup/doc/ChangeLog +++ b/winsup/doc/ChangeLog @@ -1,4 +1,8 @@ -2004-06-13 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> +2003-06-14 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> + + * how-programming.texinfo: Add section about Visual Studio linking. + +2003-06-13 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> * faq.texinfo: Move outdated calls.texinfo to readme.texinfo. * how-api.texinfo: Fix typos. diff --git a/winsup/doc/how-programming.texinfo b/winsup/doc/how-programming.texinfo index e183bbc..0f9fc70 100644 --- a/winsup/doc/how-programming.texinfo +++ b/winsup/doc/how-programming.texinfo @@ -202,6 +202,64 @@ give them to you, but you can't give them to anyone else, which is something that Red Hat can't agree to. Fortunately, we have our own Win32 headers which are pretty complete. +@subsection How do I link against @samp{cygwin1.dll} with Visual Studio? + +To my knowledge, none of the Cygwin developers have done this, but we +have this report from the mailing list that it can be done this way: + +@enumerate +@item Use the impdef program to generate a .def file for the cygwin1.dll +(if you build the cygwin dll from source, you will already have a def +file) + +@example +impdef cygwin1.dll > cygwin1.def +@end example + +@item Use the MS VS linker (lib) to generate an import library + +@example +lib /def=cygwin1.def /out=cygwin1.lib +@end example + +@item Create a file "my_crt0.c" with the following contents + +@example +#include <sys/cygwin.h> +#include <stdlib.h> + +typedef int (*MainFunc) (int argc, char *argv[], char **env); + +void + my_crt0 (MainFunc f) + @{ + cygwin_crt0(f); + @} +@end example + +@item Use gcc in a Cygwin prompt to build my_crt0.c into a DLL + (e.g. my_crt0.dll). Follow steps 1 and 2 to generate .def and + .lib files for the DLL. + +@item Download crt0.c from the cygwin website and include it in + your sources. Modify it to call my_crt0() instead of + cygwin_crt0(). Since you are using Cygwin source code, your + resulting program will be licensed under the GNU GPL. For more + information, see @file{http://gnu.org/licenses/gpl-faq.html}. + +@item Build your object files using the MS VC compiler cl. + +@item Link your object files, cygwin1.lib, and my_crt0.lib (or + whatever you called it) into the executable. +@end enumerate + +Note that if you are using any other Cygwin based libraries +that you will probably need to build them as DLLs using gcc and +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 link against a @samp{.lib} file? If your @samp{.lib} file is a normal static or import library with @@ -236,7 +294,7 @@ with Cygwin development tools. Note that this is a lot of work (half a day or so), but much less than rewriting the runtime library in question from specs... -(thanks to Jacob Navia (root@@jacob.remcomp.fr) for this explanation) +Thanks to Jacob Navia (root at jacob dot remcomp dot fr) for this explanation. @subsection How do I rebuild the tools on my NT box? |