access from a dynamic library to the main-program

lrtaylor@micron.com lrtaylor@micron.com
Mon Nov 29 21:20:00 GMT 2004


If your library depends on symbols defined in your program (such as
callback functions, etc.), then you need to link your executable so that
it exports its symbols.  If you're using GNU binutils, you can do this
by adding the following command line parameter to your command line for
linking your executable:

-Wl,-E

For example:

gcc -Wl,-E -o myprogram <etc., etc.>

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Thomas.Rogowski@t-online.de
Sent: Monday, November 29, 2004 1:49 PM
To: gcc-help@gcc.gnu.org
Subject: access from a dynamic library to the main-program

Hello!
I have a c++ program and a library separated in an executable and in a 
library file, the program loads the library dynamicaly and this library 
must have a pointer to my program.
How can I link and compile my library and my program? I use linux.
I tried to link program with library and library with program but after 
that I had two separated files and the library can't access to the 
instance of my program.

Thank you in advance
Thomas



More information about the Gcc-help mailing list