This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Non-relocatable DLLs and GCC -shared


> From: Pascal Obry <obry at act-europe dot fr> 
> --------------------------------------------------------------------------------
> 
> I'd like to know if it is possible to build non-relocatable DLLs using GCC's
> -shared option ? As far as I know this option builds relocatable DLLs...
> 
> Thanks,
> Pascal.

gcc -mdll -ofoo.dll --Wl,-out-implib,libfoo.a foo.def foo.c

(The foo.def may be omitted if symbols are marked with dllexport in
source.  Or you could try -Wl,--export-all)

For mingw32:
-mdll tells driver to pass dllcrt2.o rather than crt2.o as startup
 object to ld  and  to use  _DllMainCRTStartup@12 as entry point address.
-shared does this too.

 -mdll passes --dll to ld.
 -shared passes -shared to ld. This is where the difference is:

 --dll only says: 'use default image base for dlls'.  It doesn't  do any
 of the relocatability magic.
 -shared says: "build a relocatable dll (or more generally, a shareable
 library)"  ie, do all the things that dllwrap/dlltool would do

You can (and probably should) override the default image base with ld switch,
--image-base= xxxxxxx. 

HTH

Danny



http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]