Skip to contentSkip to conversation

Accessing global symbols from shared library

DISCUSSION Tim Moloney 3 participants 4 messages Feb 7, 2001 – Feb 8, 2001

lore
Share & tools
lore
#0 lore raw

I am currently trying to port a Solaris application to Linux. The Solaris application dynamically loads custom shared libraries which can access symbols in the main executable. This is not a clean design, but it works. From what I've seen so far, the Linux runtime loader does not allow a shared library to access symbols in the main executable.

If someone knows of a linker switch or something that allows shared libraries to access global symbols, please let me know.

Tim Moloney

ManTech Real-time Systems Laboratory
2015 Cattlemen Road
Sarasota, FL 34232
(941) 377-6775 x208

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 10 lines · Tim Moloney

I am currently trying to port a Solaris application to Linux. The Solaris application dynamically loads custom shared libraries which can access symbols in the main executable. This is not a clean design, but it works. From what I've seen so far, the Linux runtime loader does not allow a shared library to access symbols in the main executable.

If someone knows of a linker switch or something that allows shared libraries to access global symbols, please let me know.

You're probably looking for -rdynamic...

Dan

/--------------------------------\ /--------------------------------\

|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         [email protected]         |  |       [email protected]      |
\--------------------------------/  \--------------------------------/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to Tim Moloney

On Wed, 7 Feb 2001, Tim Moloney wrote:

I suggest taking a look at the implementation of the X server. It achieves such a feat routinely.

Quoted 10 lines

I am currently trying to port a Solaris application to Linux. The Solaris application dynamically loads custom shared libraries which can access symbols in the main executable. This is not a clean design, but it works. From what I've seen so far, the Linux runtime loader does not allow a shared library to access symbols in the main executable.

If someone knows of a linker switch or something that allows shared libraries to access global symbols, please let me know.

Quoted 9 lines

Tim Moloney

ManTech Real-time Systems Laboratory
2015 Cattlemen Road
Sarasota, FL 34232
(941) 377-6775 x208

--
William Blew, [email protected]
Gamer by Choice, Geek by Birth

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

Thanks for the response.

After rereading the ld man page, I discovered the -export-dynamic switch which does exactly what I want. I was either blind or confused the first time I read the ld man page.

Thanks again.

Tim Moloney

ManTech Real-time Systems Laboratory
2015 Cattlemen Road
Sarasota, FL 34232
(941) 377-6775 x208

----- Original Message -----
From: "William Blew" <[email protected]>
To: "Tim Moloney" <[email protected]>
Cc: <[email protected]>; <[email protected]>
Sent: Thursday, February 08, 2001 2:45 AM
Subject: Re: Accessing global symbols from shared library

Quoted 3 lines · Tim Moloney

I suggest taking a look at the implementation of the X server. It

achieves

Quoted 11 lines

such a feat routinely.

Quoted 9 lines

I am currently trying to port a Solaris application to Linux. The Solaris application dynamically loads custom shared libraries which can access symbols in the main executable. This is not a clean design, but it works. From what I've seen so far, the Linux runtime loader does not allow a shared library to access symbols in the main executable.

If someone knows of a linker switch or something that allows shared libraries to access global symbols, please let me know.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/