-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Description
I'm trying to invoke the functions declared in dart_dll.h from a dylib.
It looks like the names are mangled and therefore not visible under the name that the header defines.
modulovalue@MacBook-Air-von-Modestas bin % nm libdart_dll.dylib | grep 'DartDll'
000000000000461c T __Z15DartDll_RunMainP12_Dart_Handle
00000000000048d4 T __Z16DartDll_Shutdownv
000000000000406c T __Z18DartDll_Initializev
00000000000045c0 T __Z18DartDll_LoadScriptPKcS0_
0000000000004790 T __Z27DartDll_DrainMicrotaskQueuev
// Other symbols are not mangled as expected
...
0000000000041d28 T _Dart_LoadLibrary
0000000000041994 T _Dart_LoadLibraryFromKernel
000000000003f0b4 T _Dart_LoadScriptFromKernel
0000000000043d0c T _Dart_LoadingUnitLibraryUris
0000000000041338 T _Dart_LookupLibrary
0000000000036b7c T _Dart_MapContainsKey
0000000000036834 T _Dart_MapGetAt
...
I can invoke the functions under the mangled name (without one leading underscore e.g. _Z18DartDll_Initializev)
I've tried extending the macro in dart_dll.h to make these symbols 'visible' under macos:
#ifdef _WIN
#ifdef DART_DLL_EXPORTING
#define DART_DLL_EXPORT __declspec(dllexport)
#else
#define DART_DLL_EXPORT __declspec(dllimport)
#endif
#elif defined(__APPLE__) // <-
#define DART_DLL_EXPORT __attribute__((visibility("default"))) // <-
#else
#define DART_DLL_EXPORT
#endif
But that doesn't seem to have any effect i.e. the symbols are still mangled.
I feel like I'm missing something simple here, do you know what it would take to export the actual identifiers that can be found in dart_dll.h?
Metadata
Metadata
Assignees
Labels
No labels