delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/11/17/01:42:43

From: jeffdbREMOVETHIS AT netzone DOT com (Mikey)
Subject: Re: Creating a dll problem.
17 Nov 1997 01:42:43 -0800 :
Message-ID: <34720c72.3930883.cygnus.gnu-win32@smtp.netzone.com>
References: <07551A47EAD6D01186430060B025C6F41B6F39 AT ntserver DOT kiwiplan2 DOT co DOT nz>
Reply-To: jeffdbREMOVETHIS AT netzone DOT com
Mime-Version: 1.0
To: Ian Collins <Ian AT kiwiplan DOT co DOT nz>, gnu-win32 AT cygnus DOT com

If anyone has corrections to the following please post.
B19 should make fixup.o unnecessary!! whenever it gets here ;^)

>dlltool --def mylib.def --output-exp mylib.exp --dllname mylib.dll

should add -k to the above line. (-mrtd invalidates this?)
must fix all prototypes for libcygwin.a functions with __cdecl to use -mrtd
-mrtd is only useful on the compile line, not the link line.

gcc -Wl,--subsystem,windows,--dll,-e,DllMain -o mylib.dll fixup.o libXXX etc..
               ^^
and include fixup.o in the link
----------- cut here -------------
#ifdef  __CYGWIN32__
        /*
         * This section terminates the list of dll imports under cygwin32.
	 * do !!!NOT!!! use this generated .o file with mingw32, it is already
	 * included in the startup files.
	 * main is included to make it possible to link your dll with
	 * -lcygwin, which as far as I can tell you MUST do if your .exe
	 * links with it.
	 * you could also include this under *startfile: in cygwin32 specs, as
*startfile:
crt0%O%s %{dll:fixup%O%s}

for use with the -dll gcc command line switch
you may also want to use

*link:
%{windows:--subsystem windows} %{console:--subsystem console} %{dll:--dll -e _dll_entry AT 12}}
										^^ or whatever your DllMain is named
         * do NOT insert or delete any lines.
         * If you do not include this then you will have problems
         * when linking with DLLs.
         */
asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0");

int main(){ return 0; } 
#endif
----------- end cut here -------------

On Mon, 17 Nov 1997 16:10:25 +1300, you wrote:

>I have a number of C libraries that I want to make into a dll that can
>be callable from VB5.
>I created a DEF file called mylib.def
>
>I ran dlltool as follows,
>
>dlltool --def mylib.def --output-exp mylib.exp --dllname mylib.dll
>
>I then tried to create the mylib.dll using,
>
>gcc -o mylib.dll libmy1.a libmy2.a -dll -mrtd
>
>I then get the error,
>
>e:\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404\../
>../../../i386-cygwin32\lib/libcygwin.a(libcmain.o)(.text+0x54):libcmain.
>cc: undefined reference to `WinMain AT 16'
>
>What am I doing wrong (or even right)?
>
>The libmy1.a and libmy2.a are simple C modules performing normal C
>processing. (I have even performed the above with a couple of dummy
>modules that just add a number).
>
>Ian Collins. 
>KIWIPLAN NZ.
>
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
>

(jeffdbREMOVETHIS AT netzone DOT com)
delete REMOVETHIS from the above to reply
         Mikey
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019