From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1680 invoked by alias); 29 Nov 2004 21:20:07 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 1652 invoked from network); 29 Nov 2004 21:20:02 -0000 Received: from unknown (HELO masquerade.micron.com) (137.201.242.130) by sourceware.org with SMTP; 29 Nov 2004 21:20:02 -0000 Received: from mail-srv2.micron.com (localhost [127.0.0.1]) by masquerade.micron.com (8.12.9/8.12.2) with ESMTP id iATLKE56021788 for ; Mon, 29 Nov 2004 14:20:15 -0700 (MST) Received: from ntxboimbx07.micron.com (ntxboimbx07.micron.com [137.201.80.94]) by mail-srv2.micron.com (8.12.9/8.12.2) with ESMTP id iATLKEEq021780; Mon, 29 Nov 2004 14:20:14 -0700 (MST) From: lrtaylor@micron.com content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: access from a dynamic library to the main-program Date: Mon, 29 Nov 2004 21:20:00 -0000 Message-ID: <363801FFD7B74240A329CEC3F7FE4CC403096526@ntxboimbx07.micron.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: To: , X-Scanned-By: MIMEDefang 2.37 X-SW-Source: 2004-11/txt/msg00205.txt.bz2 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 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=20 library file, the program loads the library dynamicaly and this library=20 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=20 that I had two separated files and the library can't access to the=20 instance of my program. Thank you in advance Thomas