This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: dlopen ? is it possible to use with stdc++


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."

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]