From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Fortin To: Mumit Khan Cc: "'cygwin@sourceware.cygnus.com'" Subject: Re: ld, dlls, and windows libraries Date: Fri, 12 Feb 1999 10:06:00 -0000 Message-id: <36C46C50.823DE2F4@ibm.net> References: X-SW-Source: 1999-02/msg00399.html Oops, your are definitely correct. I should have checked the mail archives first. Sorry about that. And yes, I was following in instructions in the users guide. Thanks for the info!! John Fortin, fortinj@ibm.net Mumit Khan wrote: > On Fri, 12 Feb 1999, John Fortin wrote: > > > Is there the equiv. of -mwindows for ld. The trouble occurs when I > > build a DLL which uses win32 api, I get a bunch of errors for unknown > > symbols. If I manually add ( by trial and error at this point ) > > -lkernel32 -lm and other libraries, I am able to finish the build of the > > DLL. > > Is there a shortcut, or is there a list which indicates which > > functions are in which libs. I suppose I could use nm, but that seems > > inefficient. > > Yes, use gcc! > > I frequently see folks using ld to build DLLs, > and run into all sorts of problems. Why use ld when gcc does all of > this and more?? Is it because Cygwin User Guide shows the most > convoluted and error-prone way to build DLLs? Also interesting is the > aversion to using the search facility in the mailing list where I and > others have posted info on portably building DLLs many many times. > > > Here's a start: > > $ gcc -c foo1.c foo2.c > $ dllwrap -o mydll.dll -mwindows --export-all foo1.o foo2.o > > When DJ's excellent work on ld is released, you'll be able to do: > > $ gcc -shared -o mydll.dll -mwindows --export-all foo1.o foo2.o > > The --export-all exports all the non-static symbols as done on most > Unix systems. If you want to restrict the exports, you have two choices: > > - provide a DEF file via ``--def mydef.def'', or > - use __attribute__((dllexport)) or alternatively __declspec(dllexport) > in your sources, > > instead of using --export-all. The option --add-stdcall-alias adds aliases > for STDCALL symbols without the trailing @ to be compatible with MSVC. > > Regards, > Mumit From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Fortin To: Mumit Khan Cc: "'cygwin@sourceware.cygnus.com'" Subject: Re: ld, dlls, and windows libraries Date: Sun, 28 Feb 1999 23:02:00 -0000 Message-ID: <36C46C50.823DE2F4@ibm.net> References: X-SW-Source: 1999-02n/msg00391.html Message-ID: <19990228230200.GxCtBTMRdWIX8Q37bsCIIg3eCT2GUvHD1NUc6FT66rQ@z> Oops, your are definitely correct. I should have checked the mail archives first. Sorry about that. And yes, I was following in instructions in the users guide. Thanks for the info!! John Fortin, fortinj@ibm.net Mumit Khan wrote: > On Fri, 12 Feb 1999, John Fortin wrote: > > > Is there the equiv. of -mwindows for ld. The trouble occurs when I > > build a DLL which uses win32 api, I get a bunch of errors for unknown > > symbols. If I manually add ( by trial and error at this point ) > > -lkernel32 -lm and other libraries, I am able to finish the build of the > > DLL. > > Is there a shortcut, or is there a list which indicates which > > functions are in which libs. I suppose I could use nm, but that seems > > inefficient. > > Yes, use gcc! > > I frequently see folks using ld to build DLLs, > and run into all sorts of problems. Why use ld when gcc does all of > this and more?? Is it because Cygwin User Guide shows the most > convoluted and error-prone way to build DLLs? Also interesting is the > aversion to using the search facility in the mailing list where I and > others have posted info on portably building DLLs many many times. > > > Here's a start: > > $ gcc -c foo1.c foo2.c > $ dllwrap -o mydll.dll -mwindows --export-all foo1.o foo2.o > > When DJ's excellent work on ld is released, you'll be able to do: > > $ gcc -shared -o mydll.dll -mwindows --export-all foo1.o foo2.o > > The --export-all exports all the non-static symbols as done on most > Unix systems. If you want to restrict the exports, you have two choices: > > - provide a DEF file via ``--def mydef.def'', or > - use __attribute__((dllexport)) or alternatively __declspec(dllexport) > in your sources, > > instead of using --export-all. The option --add-stdcall-alias adds aliases > for STDCALL symbols without the trailing @ to be compatible with MSVC. > > Regards, > Mumit