[solved] Why -dylib works without "-pic" Linux 64-bit ?

Linux specific questions.
Post Reply
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

[solved] Why -dylib works without "-pic" Linux 64-bit ?

Post by D.J.Peters »

If I compile dynamic C/C++ Linux 64-bit libraries for FreeBASIC I must use "-fPIC" !

Why does it works without fbc "-pic" if I compile dynamic fbsound libraries for Linux 64-bit ?

Joshy
Last edited by D.J.Peters on May 10, 2021 21:11, edited 1 time in total.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Why -dylib works without "-pic" Linux 64-bit ?

Post by coderJeff »

fbc automatically adds '-fPIC' if you are compiling a shared/dynamic library. Compiler Option: -pic

But you will need to add '-pic' if compiling '-c' only to an object file and then later linking to dynamic library. i.e. if compiling and linking are done in two different steps.
Post Reply