]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dynlib.cpp
Fix wxExecute for ports other than wxMac and wxCocoa on Darwin
[wxWidgets.git] / src / common / dynlib.cpp
index e2d60444ec047053758223c201708f98c8ea4122..cfbc76281e464292aa47caa93345112d47126de1 100644 (file)
@@ -129,8 +129,12 @@ void *dlsym(void *handle, const char *symbol)
     // as on many other systems, C symbols have prepended underscores under
     // Darwin but unlike the normal dlopen(), NSLookupSymbolInModule() is not
     // aware of this
-    NSSymbol nsSymbol = NSLookupSymbolInModule( handle,
-                                                wxString(_T('_')) + symbol );
+    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;
 }