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: Hide/export symbols in static library


Hi Jyotirmoy,

I not sure what you are trying to do.  It appears to me that you are using ld to create an executable called "lib.a", which is not an archive library (.a).  Since the -r (also -i or --relocatable) creates an OMAGIC file that can be consumed by ld, maybe it serves a similar purpose.

I think you should use the ar command to create an archive library (.a).

As I understand it, the ld command consumes archive libraries (.a), as well as shared object libraries (.so) and object files (.o), to produce executables (no extension, chmod a+x) or shared object libraries (.so).

Whether or not a symbol has external linkage depends outside the translation unit depends on whether or not you've specified that the translation scope identifier is static or not (in C and C++).

NOTE (as I understand it):  C++ anonymous namespace does not mean the identifier is internally linked only.  Still need to specific static.  Unfortunately?  Perhaps.

Using ld to create a shared object library (.so) in ELF format, you can use a --version-script=FILE command.

Using ld to create a shared object library (.DLL) in i386 PE format, there are several ld flags available to control symbol exposure.

HTH,
--Eljay


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