Paul Pluzhnikov wrote:
> "Boris" <[EMAIL PROTECTED]> writes:
>
>> I'm reading as much about PIC as I can find in order to understand
>> if I should compile a library here with or without -fpic. After all
>> I tend to believe that in my case it's better not to use -fpic as 1)
>> for this library performance is critical and as 2) the library is
>> too specialized that it will be used by all kind of different
>> applications.
>
> Are you building a shared library, or an archive.

I'm building a shared library.

> If shared, note that on some platforms (e.g. Linux/x86_64) you simply
> can't build a DSO from non-PIC code (i.e. you'll have no choice).

Does this mean that g++ automatically compiles PIC code or that it aborts 
with an error unless you pass the option -fpic?

> [...]
>> If I assume that at any
>> time there is probably only one program running which makes use of
>> this library PIC doesn't make much sense
>
> If your code is statically linked into the main executable, you
> don't gain anything [1] from PIC even if there are multiple copies of
> the program running, or multiple programs that have your library
> linked in.

If I'm building a shared library and there is only one program running my 
library is linked in I don't gain anything either but have a better 
performance with non-PIC code - is this correct?

Thanks for your help,
Boris 


_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to