X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/343a06a58b3c18ed076371778baacb9f36006ac9..b9c15d1092eda519ecaae2d48eb28598fca949f1:/src/common/dynlib.cpp diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 5976df793d..2c82172f8f 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -76,6 +76,15 @@ else return (void *)0; } +#elif defined(__APPLE__) && defined(__UNIX__) +void *dlopen(const char *path, int mode /* mode is ignored */); +void *dlsym(void *handle, const char *symbol); +int dlclose(void *handle); +const char *dlerror(void); + +# define wxDllOpen(lib) dlopen(lib.fn_str(), 0) +# define wxDllGetSymbol(handle, name) dlsym(handle, name) +# define wxDllClose dlclose #elif defined(__WINDOWS__) // using LoadLibraryEx under Win32 to avoid name clash with LoadLibrary # ifdef __WIN32__ @@ -157,7 +166,7 @@ void wxLibrary::PrepareClasses(wxClassInfo *first) { if (info->m_className) classTable.Put(info->m_className, (wxObject *)info); - info = info->GetNext(); + info = (wxClassInfo *)info->GetNext(); } // Set base pointers for each wxClassInfo @@ -205,10 +214,10 @@ wxDllLoader::GetProgramHandle(void) { #if defined( HAVE_DLOPEN ) && !defined(__EMX__) // optain handle for main program - return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/); + return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/); #elif defined (HAVE_SHL_LOAD) // shl_findsymbol with NULL handle looks up in main program - return 0; + return 0; #else wxFAIL_MSG( wxT("This method is not implemented under Windows or OS/2")); return 0; @@ -221,7 +230,7 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success) { wxDllType handle; -#if defined(__WXMAC__) +#if defined(__WXMAC__) && !defined(__UNIX__) FSSpec myFSSpec ; Ptr myMainAddr ; Str255 myErrName ; @@ -294,13 +303,17 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name) { void *symbol = NULL; // return value -#if defined( __WXMAC__ ) +#if defined(__WXMAC__) && !defined(__UNIX__) Ptr symAddress ; CFragSymbolClass symClass ; Str255 symName ; - strcpy( (char*) symName , name ) ; - c2pstr( (char*) symName ) ; +#if TARGET_CARBON + c2pstrcpy( (StringPtr) symName , name ) ; +#else + strcpy( (char *) symName , name ) ; + c2pstr( (char *) symName ) ; +#endif if ( FindSymbol( dllHandle , symName , &symAddress , &symClass ) == noErr ) symbol = (void *)symAddress ; @@ -350,7 +363,8 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) if (node != NULL) return ((wxLibrary *)node->Data()); #else // !OS/2 - if ( (node = m_loaded.Find(name.GetData())) ) + node = m_loaded.Find(name.GetData()); + if ( node ) return ((wxLibrary *)node->Data()); #endif // If DLL shares data, this is necessary.