Libdl
lastmod 2020-02-29created 2016-02-186 edits
Dynamic Loader.
Dynamic Loader Function Interfaces
- dladdr
- dlclose
- dlerror
- dlopen
- dlsym
See also
Troubleshooting
Not found symbol
If the dlsym function cannot find a symbol, check it with nm as follows:
If the symbol is a lowercase t as above, it cannot be called. You need to export the function using GCC:Attribute.
// Windows:
#define EXPORT_DEF __declspec(dllexport)
// GCC
#define EXPORT_DEF __attribute__((visibility("default")))
// ...
EXPORT_DEF void _c2cPluginBaseInfo() { ... }
After compiling, checking with nm as below shows that it has changed to an uppercase T.
For reference, a lowercase t is located in the local text section, and an uppercase T in the global (external) text section.
Favorite site
Symbol load tips
- Stackoverflow - Dynamic loaded libraries and shared global symbols
- Visibility - GCC Wiki
- Mac OS X - Manual Page For dlopen(3)
- Dynamic Library Programming Topics
Pages that link here