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]

Re: Difference between -shared, -symbolic, and -G?


Andrew Haley wrote:
I am using gcc version 4.3.3 for x86

-Wl,-Bsymbolic looks like it does what I want.

Be very, very careful. -Bsymbolic violates the C standard, and all manner of very weird things can happen to your program. One symptom is that data in a shared library that is written by an executable fails mysteriously to be there when read by the library. This is because you end up with two copies of the data, one in the shared library and one in the executable, even though the data is only defined once in the library. It is possible to solve most of these problems by compiling the executable as PIC.

Andrew.


Hmm. I just need to have a function in my shared library, callable from the executable linked against the shared library, which I can also call from inside the shared library such that calls originating inside always invoke the one defined inside. What is the right way to achieve this, then?


-Todd


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