* access from a dynamic library to the main-program
@ 2004-11-29 20:49 Thomas.Rogowski
0 siblings, 0 replies; 2+ messages in thread
From: Thomas.Rogowski @ 2004-11-29 20:49 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: access from a dynamic library to the main-program
@ 2004-11-29 21:20 lrtaylor
0 siblings, 0 replies; 2+ messages in thread
From: lrtaylor @ 2004-11-29 21:20 UTC (permalink / raw)
To: Thomas.Rogowski, gcc-help
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-29 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29 20:49 access from a dynamic library to the main-program Thomas.Rogowski
2004-11-29 21:20 lrtaylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).