diff options
author | Christopher Faylor <me@cgf.cx> | 2002-08-21 15:45:04 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-08-21 15:45:04 +0000 |
commit | d3106bef0a93865a9c24bd09d39e42c53029b3f8 (patch) | |
tree | a99fbae70f36d4c7f36af8741086d4133cbb39aa /winsup | |
parent | 62012a3f3134ff4860685b09b50fed01ef326972 (diff) | |
download | cygnal-d3106bef0a93865a9c24bd09d39e42c53029b3f8.tar.gz cygnal-d3106bef0a93865a9c24bd09d39e42c53029b3f8.tar.bz2 cygnal-d3106bef0a93865a9c24bd09d39e42c53029b3f8.zip |
* dll.sgml: Refine dll build instructions.
* ntsec.html: Correct some typos.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/doc/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/doc/dll.sgml | 62 | ||||
-rw-r--r-- | winsup/doc/ntsec.sgml | 4 |
3 files changed, 35 insertions, 39 deletions
diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog index cc5cfe84d..fb8853363 100644 --- a/winsup/doc/ChangeLog +++ b/winsup/doc/ChangeLog @@ -1,3 +1,11 @@ +2002-06-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> + + * dll.sgml: Refine dll build instructions. + +2002-08-21 Christopher Faylor <cgf@redhat.com> + + * ntsec.html: Correct some typos. + 2002-07-23 Nicholas Wourms <nwourms@netscape.net> * calls.texinfo: Add fcloseall and fcloseall_r. diff --git a/winsup/doc/dll.sgml b/winsup/doc/dll.sgml index 274f12926..724c42d06 100644 --- a/winsup/doc/dll.sgml +++ b/winsup/doc/dll.sgml @@ -41,52 +41,40 @@ For this example, we'll use a single file <para>Now compile everything to objects:</para> -<screen> -gcc -c myprog.c -gcc -c mydll.c -</screen> +<screen>gcc -c myprog.c +gcc -c mydll.c</screen> -<para>Unfortunately, the process for building a dll is, well, convoluted. -You have to run five commands, like this:</para> +<para>Fortunately, with the latest gcc and binutils the process for building a dll +is now much simpler. Say you want to build this minimal function in mydll.c:</para> -<screen> -gcc -s -Wl,--base-file,mydll.base -o mydll.dll mydll.o -Wl,-e,_mydll_init@12 -dlltool --base-file mydll.base --def mydll.def --output-exp mydll.exp --dllname mydll.dll -gcc -s -Wl,--base-file,mydll.base,mydll.exp -o mydll.dll mydll.o -Wl,-e,_mydll_init@12 -dlltool --base-file mydll.base --def mydll.def --output-exp mydll.exp --dllname mydll.dll -gcc -Wl,mydll.exp -o mydll.dll mydll.o -Wl,-e,_mydll_init@12 -</screen> +<screen>int WINAPI +mydll_init(HANDLE h, DWORD reason, void *foo) +{ + return 1; +}</screen> -<para>The extra steps give <filename>dlltool</filename> the -opportunity to generate the extra sections (exports and relocation) -that a dll needs. After this, you build the import library:</para> +<para>First compile mydll.c to object code:</para> -<screen> -dlltool --def mydll.def --dllname mydll.dll --output-lib mydll.a -</screen> +<screen>gcc -c mydll.c</screen> -<para>Now, when you build your program, you link against the import -library:</para> +<para>Then, tell gcc that it is building a shared library:</para> -<screen> -gcc -o myprog myprog.o mydll.a -</screen> +<screen>gcc -shared -o mydll.dll mydll.o</screen> -<para>Note that we linked with <command>-e _mydll_init@12</command>. -This tells the OS what the DLL's "entry point" is, and this is a -special function that coordinates bringing the dll to life withing the -OS. The minimum function looks like this:</para> - -<screen> -#include <windows.h> +<para>That's it! However, if you are building a dll as an export library, +you will probably want to use the complete syntax:</para> -int WINAPI -mydll_init(HANDLE h, DWORD reason, void *foo) -{ - return 1; -} -</screen> +<screen>gcc -shared -o cyg${module}.dll \ + -Wl,--out-implib=lib${module}.dll.a \ + -Wl,--export-all-symbols \ + -Wl,--enable-auto-import \ + -Wl,--whole-archive ${old_lib} \ + -Wl,--no-whole-archive ${dependency_libs}</screen> +<para>Where ${module} is the name of your DLL, ${old_lib} are all +your object files, bundled together in static libs or single object +files and the ${dependency_libs} are import libs you need to +link against, e.g '-lpng -lz -L/usr/local/special -lmyspeciallib'.</para> </sect2> <sect2 id="dll-link"><title>Linking Against DLLs</title> diff --git a/winsup/doc/ntsec.sgml b/winsup/doc/ntsec.sgml index 8bb8a50ea..7f38fd755 100644 --- a/winsup/doc/ntsec.sgml +++ b/winsup/doc/ntsec.sgml @@ -286,9 +286,9 @@ powerusers::547: </screen> </example> -<para>As you can see I've changed my primary group membership from 513 (None) +<para>As you can see, I've changed my primary group membership from 513 (None) to 547 (powerusers). So all file I created inside of Cygwin were now owned -by the powerusers group instead of None. This is the way I liked it.<para> +by the powerusers group instead of None. This is the way I liked it.</para> <para>Groups may be mentioned in the passwd file, too. This has two advantages:</para> |