- void *addr;
-
- NSSymbol nsSymbol = NSLookupSymbolInModule( handle , symbol ) ;
-
- if ( nsSymbol)
- {
- addr = NSAddressOfSymbol(nsSymbol);
- }
- else
- {
- addr = NULL;
- }
- return addr;
+ // as on many other systems, C symbols have prepended underscores under
+ // Darwin but unlike the normal dlopen(), NSLookupSymbolInModule() is not
+ // aware of this
+ wxCharBuffer buf(strlen(symbol) + 1);
+ char *p = buf.data();
+ p[0] = '_';
+ strcpy(p + 1, symbol);
+
+ NSSymbol nsSymbol = NSLookupSymbolInModule( handle, p );
+ return nsSymbol ? NSAddressOfSymbol(nsSymbol) : NULL;