This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How can I make ELF library in C++ ?
- To: Erik Mouw <J dot A dot K dot Mouw at ITS dot TUDelft dot NL>
- Subject: Re: How can I make ELF library in C++ ?
- From: Ghost in the shell <dodeskaden at free dot fr>
- Date: Tue, 27 Feb 2001 18:02:03 +0100 (CET)
- Cc: <gcc at gcc dot gnu dot org>
On Mon, 26 Feb 2001, Erik Mouw wrote:
> > I've seen that there were some troubles when I try to use dlsym in a C++
> > program because the ELF format library compiled by g++ doesn't look like
> > the ELF's one compiled by a c compiler.
>
> Loading C++ modules in C programs is non trivial because C++ code
> usually needs some initialisation.
>
> > I'm asking How to make and use ELF library in c++ ?
>
> Use libtool to make library files, see http://www.gnu.org/software/libtool/
> (or "apt-get install libtool" on your Debian system).
>
> To use them, have a look at the GLib's portable method for loading
> "plug-ins":
>
> http://developer.gnome.org/doc/API/glib/glib-dynamic-loading-of-modules.html
>
>
> Erik
>
> --
> J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
> of Electrical Engineering, Faculty of Information Technology and Systems,
> Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
> Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A.K.Mouw@its.tudelft.nl
> WWW: http://www-ict.its.tudelft.nl/~erik/
>
I use libtool and glib's support but:
I can't use C++ shared library because it seems that the functions symbols
name in my src ***.cpp have a longer name in the lib***.so. For example:
in src in ELF library
hello becomes hello__Fv
That happens every time and I need to do g_module_open(..,"hello__Fv",..);
if I want to load it.
That isn't a really good way, so ... (and when I use classes, it's going
worst)
I'd like that C++ loves 'plug-ins' in the C way. ( in C, it so simple..)
GiTs
PS: Why should I use glib instead of <dlfnc> ?