HP-UX compilation fixes (thanks to Zdravko Bas)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,16 +16,20 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <wx/setup.h>
|
||||||
|
|
||||||
|
#if wxUSE_DYNLIB_CLASS
|
||||||
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/list.h>
|
#include <wx/list.h>
|
||||||
#include <wx/hash.h>
|
#include <wx/hash.h>
|
||||||
|
|
||||||
// TODO should be done by configure
|
// this is normally done by configure, but I leave it here for now...
|
||||||
#if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHLLOAD))
|
#if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD))
|
||||||
#if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__) || defined(__FREEBSD__)
|
#if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__) || defined(__FREEBSD__)
|
||||||
#define HAVE_DLOPEN
|
#define HAVE_DLOPEN
|
||||||
#elif defined(__HPUX__)
|
#elif defined(__HPUX__)
|
||||||
#define HAVE_SHLLOAD
|
#define HAVE_SHL_LOAD
|
||||||
#endif // Unix flavour
|
#endif // Unix flavour
|
||||||
#endif // !Unix or already have some HAVE_xxx defined
|
#endif // !Unix or already have some HAVE_xxx defined
|
||||||
|
|
||||||
@@ -33,10 +37,10 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
typedef void *wxDllType;
|
typedef void *wxDllType;
|
||||||
#elif defined(HAVE_SHLLOAD)
|
#elif defined(HAVE_SHL_LOAD)
|
||||||
#include <dl.h>
|
#include <dl.h>
|
||||||
|
|
||||||
typedef void *wxDllType;
|
typedef shl_t wxDllType;
|
||||||
#elif defined(__WINDOWS__)
|
#elif defined(__WINDOWS__)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
@@ -62,7 +66,7 @@ public:
|
|||||||
wxHashTable classTable;
|
wxHashTable classTable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxLibrary(void *handle);
|
wxLibrary(wxDllType handle);
|
||||||
~wxLibrary();
|
~wxLibrary();
|
||||||
|
|
||||||
// Get a symbol from the dynamic library
|
// Get a symbol from the dynamic library
|
||||||
@@ -112,4 +116,6 @@ wxClassInfo *wxGetClassFirst() { \
|
|||||||
return wxClassInfo::GetFirst(); \
|
return wxClassInfo::GetFirst(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_DYNLIB_CLASS
|
||||||
|
|
||||||
#endif // _WX_DYNLIB_H__
|
#endif // _WX_DYNLIB_H__
|
||||||
|
@@ -27,10 +27,13 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif //__BORLANDC__
|
#endif //__BORLANDC__
|
||||||
|
|
||||||
|
#if wxUSE_DYNLIB_CLASS
|
||||||
|
|
||||||
#include "wx/dynlib.h"
|
#include "wx/dynlib.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/tokenzr.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// conditional compilation
|
// conditional compilation
|
||||||
@@ -40,14 +43,14 @@
|
|||||||
#define wxDllOpen(lib) dlopen(lib, RTLD_LAZY)
|
#define wxDllOpen(lib) dlopen(lib, RTLD_LAZY)
|
||||||
#define wxDllGetSymbol(handle, name) dlsym(handle, (char *)name)
|
#define wxDllGetSymbol(handle, name) dlsym(handle, (char *)name)
|
||||||
#define wxDllClose dlclose
|
#define wxDllClose dlclose
|
||||||
#elif defined(HAVE_SHLLOAD)
|
#elif defined(HAVE_SHL_LOAD)
|
||||||
#define wxDllOpen(lib) shl_open(lib, BIND_DEFERRED, 0)
|
#define wxDllOpen(lib) shl_load(lib, BIND_DEFERRED, 0)
|
||||||
#define wxDllClose shl_unload
|
#define wxDllClose shl_unload
|
||||||
|
|
||||||
static inline void *wxDllGetSymbol(shl_t *handle, const char *name)
|
static inline void *wxDllGetSymbol(shl_t handle, const char *name)
|
||||||
{
|
{
|
||||||
void *sym;
|
void *sym;
|
||||||
if ( shl_findsym(handle, name, TYPE_UNDEFINED, &sym) == 0 )
|
if ( shl_findsym(&handle, name, TYPE_UNDEFINED, &sym) == 0 )
|
||||||
return sym;
|
return sym;
|
||||||
else
|
else
|
||||||
return (void *)0;
|
return (void *)0;
|
||||||
@@ -77,7 +80,11 @@ static wxString ConstructLibraryName(const wxString& basename)
|
|||||||
wxString fullname(basename);
|
wxString fullname(basename);
|
||||||
|
|
||||||
#if defined(__UNIX__)
|
#if defined(__UNIX__)
|
||||||
|
#if defined(__HPUX__)
|
||||||
|
fullname << ".sl";
|
||||||
|
#else //__HPUX__
|
||||||
fullname << ".so";
|
fullname << ".so";
|
||||||
|
#endif //__HPUX__
|
||||||
#elif defined(__WINDOWS__)
|
#elif defined(__WINDOWS__)
|
||||||
fullname << ".dll";
|
fullname << ".dll";
|
||||||
#endif
|
#endif
|
||||||
@@ -215,11 +222,30 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
|||||||
wxString lib_name = ConstructLibraryName(name);
|
wxString lib_name = ConstructLibraryName(name);
|
||||||
|
|
||||||
#if defined(__UNIX__)
|
#if defined(__UNIX__)
|
||||||
// TODO use LD_LIBRARY_PATH!
|
// found the first file in LD_LIBRARY_PATH with this name
|
||||||
lib_name.Prepend("/lib");
|
wxString libPath("/lib:/usr/lib"); // system path first
|
||||||
|
const char *envLibPath = getenv("LD_LIBRARY_PATH");
|
||||||
|
if ( envLibPath )
|
||||||
|
libPath << ':' << envLibPath;
|
||||||
|
wxStringTokenizer tokenizer(libPath, ':');
|
||||||
|
while ( tokenizer.HasMoreToken() )
|
||||||
|
{
|
||||||
|
wxString fullname(tokenizer.NextToken());
|
||||||
|
|
||||||
|
fullname << '/' << lib_name;
|
||||||
|
if ( wxFileExists(fullname) )
|
||||||
|
{
|
||||||
|
lib_name = fullname;
|
||||||
|
|
||||||
|
// found the library
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//else: not found in the path, leave the name as is (secutiry risk?)
|
||||||
|
|
||||||
#endif // __UNIX__
|
#endif // __UNIX__
|
||||||
|
|
||||||
wxDllType handle ;
|
wxDllType handle;
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
FSSpec myFSSpec ;
|
FSSpec myFSSpec ;
|
||||||
@@ -269,3 +295,5 @@ wxObject *wxLibraries::CreateObject(const wxString& path)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_DYNLIB_CLASS
|
||||||
|
Reference in New Issue
Block a user