X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/297a3fece1b9e5a55ba24941462c99d549403719..0812732316f715a480526cedcd481e7fc31a130c:/src/common/dynlib.cpp diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 02d2cdb35f..6b8bf78e38 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -31,7 +31,7 @@ // System dependent include // --------------------------------------------------------------------------- -#if defined(__UNIX__) || defined(__unix__) +#if defined(__UNIX__) #include #endif @@ -71,7 +71,7 @@ wxLibrary::wxLibrary(void *handle) wxLibrary::~wxLibrary() { if (m_handle && m_destroy) { -#if defined(__UNIX__) || defined(__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) { -#if defined(__UNIX__) || defined(__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; } @@ -158,7 +169,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) old_sm_first = wxClassInfo::sm_first; wxClassInfo::sm_first = NULL; -#if defined(__UNIX__) || defined(__unix__) +#if defined(__UNIX__) lib_name.Prepend("./lib"); lib_name += ".so"; @@ -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