This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: dlopen ? is it possible to use with stdc++
- To: libstdc++ at sources dot redhat dot com
- Subject: Re: dlopen ? is it possible to use with stdc++
- From: Levente Farkas <lfarkas at mindmaker dot hu>
- Date: Wed, 18 Oct 2000 09:18:55 +0200
- Cc: Gabriel Dos Reis <Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr>,brent verner <brent at rcfile dot org>
- Organization: Mindmaker Ltd.
- References: <39EC6687.A171C779@mindmaker.hu> <flbswjtopy.fsf@sel.cmla.ens-cachan.fr>
- Reply-To: lfarkas at mindmaker dot hu
Gabriel Dos Reis wrote:
>
> Levente Farkas <lfarkas@mindmaker.hu> writes:
>
> | hi,
> | I'm try to use a simple shared library:
> | ---------------------------
> | #include <iostream>
> |
> | void test1()
> | {
> | cout << "test1";
> | }
> | ---------------------------
> | compile it with :
> | g++ -c -fPIC -fhonor-std test.cpp -o test.o
> | create a shared lib with:
> | export LD_LIBRARY_PATH=/home/lfarkas
> | g++ test1.o -L/home/lfarkas/ -shared -Wl,-soname,libtest.so.1 -o
> | /home/lfarkas/libtest.so.1.0
> | than compile the following test:
> | ---------------------------
> | #include <stdio.h>
> | #include <dlfcn.h>
> |
> | int main(int /*argc*/, char** /*args*/)
> | {
> | void* handle;
> | handle = dlopen("libtest.so", RTLD_LAZY);
> | if (!handle)
> | {
> | fputs(dlerror(), stderr);
> | return 1;
> | }
> | fputs("betoltve", stdout);
> | typedef void (*type)();
> | type func = (type)dlsym(handle, "test1");
>
> Please note that test1 has C++ linkage and is likely to be decorated.
>
> This is not an issue specific to v3. It is an issue about how to
> dlsym C++ names, and as such has nothing to do with v3.
it seems I write it too fast and everybody (about 5 people) find this typo
in my example, BUT the problem in dlopen!!! if you delete the last 4 lines
of the main function (which I put there just demostration) the program still
core dumped, what's more it's can't reach the dlerror()!!!
simple if I try to dlopen a shared library which use stdc++ dlopen crash!
more tipp?
-- Levente http://petition.eurolinux.org/index_html
"The only thing worse than not knowing the truth is
ruining the bliss of ignorance."