fix compilation for the platforms which don't have RTLD_NOW/GLOBAL (like OpenBSD 3.0)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-05-10 18:28:16 +00:00
parent d29b553b85
commit ee1107cf73

View File

@ -102,6 +102,9 @@ bool wxDynamicLibrary::Load(wxString libname, int flags)
} }
} }
// different ways to load a shared library
//
// FIXME: should go to the platform-specific files!
#if defined(__WXMAC__) && !defined(__DARWIN__) #if defined(__WXMAC__) && !defined(__DARWIN__)
FSSpec myFSSpec; FSSpec myFSSpec;
Ptr myMainAddr; Ptr myMainAddr;
@ -133,29 +136,39 @@ bool wxDynamicLibrary::Load(wxString libname, int flags)
#if defined(__VMS) || defined(__DARWIN__) #if defined(__VMS) || defined(__DARWIN__)
m_handle = dlopen(libname.c_str(), 0); // The second parameter is ignored m_handle = dlopen(libname.c_str(), 0); // The second parameter is ignored
#else #else // !__VMS && !__DARWIN__
int rtldFlags = 0; int rtldFlags = 0;
if( flags & wxDL_LAZY ) if ( flags & wxDL_LAZY )
{ {
wxASSERT_MSG( (flags & wxDL_NOW) == 0, wxASSERT_MSG( (flags & wxDL_NOW) == 0,
_T("wxDL_LAZY and wxDL_NOW are mutually exclusive.") ); _T("wxDL_LAZY and wxDL_NOW are mutually exclusive.") );
#ifdef RTLD_LAZY
rtldFlags |= RTLD_LAZY; rtldFlags |= RTLD_LAZY;
} #else
else if( flags & wxDL_NOW ) wxLogDebug(_T("wxDL_LAZY is not supported on this platform"));
{
rtldFlags |= RTLD_NOW;
}
if( flags & wxDL_GLOBAL )
{
#ifdef __osf__
wxLogDebug(_T("WARNING: RTLD_GLOBAL is not a supported on this platform."));
#endif #endif
}
else if ( flags & wxDL_NOW )
{
#ifdef RTLD_NOW
rtldFlags |= RTLD_NOW;
#else
wxLogDebug(_T("wxDL_NOW is not supported on this platform"));
#endif
}
if ( flags & wxDL_GLOBAL )
{
#ifdef RTLD_GLOBAL
rtldFlags |= RTLD_GLOBAL; rtldFlags |= RTLD_GLOBAL;
#else
wxLogDebug(_T("RTLD_GLOBAL is not supported on this platform."));
#endif
} }
m_handle = dlopen(libname.c_str(), rtldFlags); m_handle = dlopen(libname.c_str(), rtldFlags);
#endif // __VMS || __DARWIN__ #endif // __VMS || __DARWIN__ ?
#elif defined(HAVE_SHL_LOAD) #elif defined(HAVE_SHL_LOAD)
int shlFlags = 0; int shlFlags = 0;
@ -174,9 +187,8 @@ bool wxDynamicLibrary::Load(wxString libname, int flags)
#elif defined(__WINDOWS__) #elif defined(__WINDOWS__)
m_handle = ::LoadLibrary(libname.c_str()); m_handle = ::LoadLibrary(libname.c_str());
#else #else
#error "runtime shared lib support not implemented" #error "runtime shared lib support not implemented on this platform"
#endif #endif
if ( m_handle == 0 ) if ( m_handle == 0 )