BUG: Including file within a namespace{} is dangerous(unless symbols are within an extern C). Also update documentation about special case for MacOSX
This commit is contained in:
parent
cdc3c9d18b
commit
d91bd3dbd3
|
@ -25,9 +25,9 @@
|
||||||
|
|
||||||
// This file is actually 3 different implementations.
|
// This file is actually 3 different implementations.
|
||||||
// 1. HP machines which uses shl_load
|
// 1. HP machines which uses shl_load
|
||||||
// 2. Power PC MAC which uses GetSharedLibrary
|
// 2. Mac OS X 10.2.x and earlier which uses NSLinkModule
|
||||||
// 3. Windows which uses LoadLibrary
|
// 3. Windows which uses LoadLibrary
|
||||||
// 4. Most unix systems which use dlopen (default )
|
// 4. Most unix systems (including Mac OS X 10.3 and later) which use dlopen (default)
|
||||||
// Each part of the ifdef contains a complete implementation for
|
// Each part of the ifdef contains a complete implementation for
|
||||||
// the static methods of DynamicLoader.
|
// the static methods of DynamicLoader.
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ LibHandle DynamicLoader::OpenLibrary(const char* libname )
|
||||||
{
|
{
|
||||||
NSObjectFileImageReturnCode rc;
|
NSObjectFileImageReturnCode rc;
|
||||||
NSObjectFileImage image = 0;
|
NSObjectFileImage image = 0;
|
||||||
|
|
||||||
rc = NSCreateObjectFileImageFromFile(libname, &image);
|
rc = NSCreateObjectFileImageFromFile(libname, &image);
|
||||||
if(!image)
|
if(!image)
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ int DynamicLoader::CloseLibrary( LibHandle lib)
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle /* lib */, const char* sym)
|
DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle /* lib */, const char* sym)
|
||||||
{
|
{
|
||||||
void *result=0;
|
void *result=0;
|
||||||
if(NSIsSymbolNameDefined(sym))
|
if(NSIsSymbolNameDefined(sym))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,28 +16,40 @@
|
||||||
|
|
||||||
#include <@KWSYS_NAMESPACE@/Configure.h>
|
#include <@KWSYS_NAMESPACE@/Configure.h>
|
||||||
|
|
||||||
namespace @KWSYS_NAMESPACE@
|
|
||||||
{
|
|
||||||
// Ugly stuff for library handles
|
// Ugly stuff for library handles
|
||||||
// They are different on several different OS's
|
// They are different on several different OS's
|
||||||
#if defined(__hpux)
|
#if defined(__hpux)
|
||||||
#include <dl.h>
|
#include <dl.h>
|
||||||
|
namespace @KWSYS_NAMESPACE@
|
||||||
|
{
|
||||||
typedef shl_t LibHandle;
|
typedef shl_t LibHandle;
|
||||||
|
} // namespace @KWSYS_NAMESPACE@
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
namespace @KWSYS_NAMESPACE@
|
||||||
|
{
|
||||||
typedef HMODULE LibHandle;
|
typedef HMODULE LibHandle;
|
||||||
|
} // namespace @KWSYS_NAMESPACE@
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
|
namespace @KWSYS_NAMESPACE@
|
||||||
|
{
|
||||||
typedef NSModule LibHandle;
|
typedef NSModule LibHandle;
|
||||||
|
} // namespace @KWSYS_NAMESPACE@
|
||||||
#else
|
#else
|
||||||
|
namespace @KWSYS_NAMESPACE@
|
||||||
|
{
|
||||||
typedef void* LibHandle;
|
typedef void* LibHandle;
|
||||||
|
} // namespace @KWSYS_NAMESPACE@
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
namespace @KWSYS_NAMESPACE@
|
||||||
|
{
|
||||||
typedef void* LibHandle;
|
typedef void* LibHandle;
|
||||||
#endif
|
|
||||||
} // namespace @KWSYS_NAMESPACE@
|
} // namespace @KWSYS_NAMESPACE@
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace @KWSYS_NAMESPACE@
|
namespace @KWSYS_NAMESPACE@
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue