Erik Leunissen <e.leunissen@xxxxxxxxx> writes: > I am developing a library that needs to be dynamically loaded into an > application. > > I am unsure whether or not to generate position independent code for > this library. I just don't know which considerations are relevant for > such a decision. > > Could anybody enlighten me (or point me to information where I could > enlighten myself)? It is normally more efficient to use -fPIC when compiling any code that is going to be linked into any shared library. So you should use -fPIC. It is more efficient because with -fPIC code the dynamic linker (including dlopen) has to apply fewer dynamic relocations at run time. Ian