X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/856d2e527d20faf46ce40734e858c7cc92b2f704..89c684ef8280e2d91096da2d96ba36e24a1fb917:/src/common/dynlib.cpp diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 6fcdf2cd63..6b8bf78e38 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -31,7 +31,7 @@ // System dependent include // --------------------------------------------------------------------------- -#ifdef __UNIX__ +#if defined(__UNIX__) #include #endif @@ -71,7 +71,7 @@ wxLibrary::wxLibrary(void *handle) wxLibrary::~wxLibrary() { if (m_handle && m_destroy) { -#ifdef __UNIX__ +#if defined(__UNIX__) dlclose(m_handle); #endif #ifdef __WINDOWS__ @@ -115,11 +115,22 @@ void wxLibrary::PrepareClasses(wxClassInfo *first) void *wxLibrary::GetSymbol(const wxString& symbname) { -#ifdef __UNIX__ +#if defined(__UNIX__) return dlsym(m_handle, WXSTRINGCAST symbname); -#endif -#ifdef __WINDOWS__ +#elif defined( __WINDOWS__ ) return GetProcAddress((HINSTANCE) m_handle, WXSTRINGCAST symbname); +#elif defined( __WXMAC__ ) + Ptr symAddress ; + CFragSymbolClass symClass ; + Str255 symName ; + + strcpy( (char*) symName , symbname ) ; + c2pstr( (char*) symName ) ; + + if ( FindSymbol( (CFragConnectionID) m_handle , symName , &symAddress , &symClass ) == noErr ) + { + return symAddress ; + } #endif return NULL; } @@ -175,11 +186,29 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) #ifdef UNICODE HMODULE handle = LoadLibraryW(lib_name); +#else +#ifdef __WIN16__ + HMODULE handle = ::LoadLibrary(lib_name); #else HMODULE handle = LoadLibraryA(lib_name); +#endif #endif if (!handle) return NULL; +#elif defined(__WXMAC__) + FSSpec myFSSpec ; + CFragConnectionID handle ; + Ptr myMainAddr ; + Str255 myErrName ; + + wxMacPathToFSSpec( lib_name , &myFSSpec ) ; + if (GetDiskFragment( &myFSSpec , 0 , kCFragGoesToEOF , "\p" , kPrivateCFragCopy , &handle , &myMainAddr , + myErrName ) != noErr ) + { + p2cstr( myErrName ) ; + wxASSERT_MSG( 1 , (char*)myErrName ) ; + return NULL ; + } #else return NULL; #endif @@ -199,7 +228,7 @@ wxObject *wxLibraries::CreateObject(const wxString& path) while (node) { obj = ((wxLibrary *)node->Data())->CreateObject(path); - if (obj) + if (obj) return obj; node = node->Next();