Answer the question
In order to leave comments, you need to log in
Exporting functions from .so library?
__attribute__((dllexport)) bool exported_test_function()
{
std::cout << "Function Called Externally" << std::endl;
return true;
}
src/cpp.licenses.cpp:25:56: warning: 'dllexport' attribute directive ignored [-Wattributes]
25 | __ __attribute ((dllexport)) bool exported_test_function ()
bin / Release / libdlicenses.so: file format elf64-x86-64
DYNAMIC SYMBOL TABLE:
0000000000000000 w D * UND * __cxa_finalize
0000000000000000 0000000000000000 w D * UND * _ITM_registerTMCloneTable
0000000000000000 0000000000000000 w D * UND * 0000000000000000 _ITM_deregisterTMCloneTable
0000000000000000 w D *UND* 0000000000000000 __gmon_start__
__attribute__((visibility("default"))) bool exported_test_function()
Answer the question
In order to leave comments, you need to log in
Since in gcc tags:
If I remember correctly, in gcc, by default, exports
dll[export|import] symbols, these are msvc attributes
when developing on msvc, it is customary to write macros for such attributes
#if defined(BUILDING)
#define DLL_ATTR __declspec(dllexport)
#else
#define DLL_ATTR __declspec(dllimport)
#endif
The same problem, there is no exported_test_function in the export table, how to fix it?
$ cat > 1027136.cс
__attribute__((visibility("default"))) bool exported_test_function()
{
return true;
}
$ g++ -fPIC -shared 1027136.cc -o 1027136.so
$ objdump -T 1027136.so
1027136.so: file format elf64-x86-64
DYNAMIC SYMBOL TABLE:
0000000000000000 w DF *UND* 0000000000000000 GLIBC_2.2.5 __cxa_finalize
0000000000000000 w D *UND* 0000000000000000 _ITM_deregisterTMCloneTable
0000000000000000 w D *UND* 0000000000000000 __gmon_start__
0000000000000000 w D *UND* 0000000000000000 _ITM_registerTMCloneTable
00000000000010f5 g DF .text 000000000000000b Base _Z22exported_test_functionv
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question