// код библиотекиvoid CallMakeDir( void ){ typedef void (*theFunc)(void); theFunc MakeDir = (theFunc) dlsym(RTLD_DEFAULT, "MakeDir"); if (MakeDir) MakeDir(); }
void * hand2exe = dlopen(0, RTLD_LAZY); theFunc MakeDir = (theFunc) dlsym(hand2exe, "MakeDir");
extern "C" {void MakeDir( void );}
C++ (Qt)extern "C" void check_device(check_device_t *cd){ ....}
C++ (Qt)void Application::checkLibrary(const char* lib_path_name){ ... void* ld = dlopen(lib_path_name, RTLD_NOW); if (!ld) { std::cerr << "...."; return; } LibraryElement *le = new LibraryElement; *(void**)(&le->check_device) = dlsym(ld, "check_device"); if (le->check_device == 0) { std::cerr << "...."; } ...}
C++ (Qt)class LibraryElement{...public:void (*check_device) (check_device_t *cd);...}
// дамп ф-ции exe afqkf, dlsym НЕ находит 081abba4 g F .text 00000035 MakeDir
// дамп ф-ции библиотеки, dlsym находит 00036a5e g F .text 000000ea Main
/usr/bin/ld: No such file: No such file or directorycollect2: ld returned 1 exit status
-Wl, -export-dynamic