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: lfarkas at mindmaker dot hu
- Subject: Re: dlopen ? is it possible to use with stdc++
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr>
- Date: 17 Oct 2000 18:30:17 +0200
- Cc: STDC++ <libstdc++ at sources dot redhat dot com>
- Organization: CMLA, ENS Cachan -- CNRS UMR 8536 (France)
- References: <39EC6687.A171C779@mindmaker.hu>
- Reply-To: libstdc++ at sources dot redhat dot com
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.
-- Gaby