Subject: Re: MUCH faster cygwin.dll
From: [email-masked]

21 Feb 1998 18:56:33 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
To: [email-masked]
Cc: [email-masked]

In gnu-win32 [email-masked] writes:

>Gee guys, noone talks about the `-fPIC' option of gcc.  Using position-
>independent code means never having to relocate.  Or does it?

Well, yes, it does.

The gcc -fPIC option is intended for use with an SVR4 style dynamic
loader, as is used on ELF and SunOS systems.  The SVR4 dynamic loader
serves much the same function as the Windows loader which handles the
..reloc section.  There actually is relocation involved.

The changes made by using -fPIC are related to the advantages ELF
shared libraries have over Windows DLLs: you can override any function
in an ELF shared library with a function in the main executable (e.g.,
you can arrange for a shared library to call your version of malloc,
even if the library provides its own version of malloc), and you can
use global variables in a shared library without any of this
declspec(dllimport)/declspec(dllexport) nonsense.

Mind you, those advantages of ELF shared libraries work even if you
don't use -fPIC.  However, if you do use -fPIC, the dynamic loader
will be able to process your shared library more efficiently.

In any case, -fPIC will not help in any way on Windows.

Ian
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".