1

I studied and tested the following URLS closely, Calling function in shared library (Linux) get Segmentation Fault as well as https://git.xeserv.us/Quora/dlsym-example/src/master/testprog.c. My question is how to map dlsym to a non-static C++ member function similar to this C function example. If I substitute C function syntax for a non-static C++ member function , I get a no-op.

   void *lib;              /* void pointer named lib */
   void (*sayHello)(void); /* void pointer named sayHello */
   lib = dlopen("helloWorld.so", RTLD_NOW);

   *(void **) (&sayHello) = dlsym(lib,"_ZN19CDataTransferServer10InitializeEi13CC_SAMPLETYPEjjj");

Any help is appreciated.

4

1 に答える 1

1

で抽出されたマングル名でメソッドをロードすることを検討してください

readelf -Ws libmy.so

また

nm -g libmy.o
于 2016-01-04T18:41:47.717 に答える