[Hdrflow-svn] SF.net SVN: hdrflow: [254] trunk
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2007-08-19 11:06:33
|
Revision: 254 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=254&view=rev Author: glslang Date: 2007-08-19 04:06:26 -0700 (Sun, 19 Aug 2007) Log Message: ----------- + separates shared object functions from main code Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am trunk/lib/openlibraries/src/openpluginlib/pl/registry.cpp trunk/unity.sh Added Paths: ----------- trunk/lib/openlibraries/src/openpluginlib/pl/shlib.cpp trunk/lib/openlibraries/src/openpluginlib/pl/shlib.hpp Modified: trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am 2007-08-18 19:45:10 UTC (rev 253) +++ trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am 2007-08-19 11:06:26 UTC (rev 254) @@ -46,6 +46,8 @@ smallstringopt.h \ stream.hpp \ stream.cpp \ + shlib.hpp \ + shlib.cpp \ vectorstringstorage.h \ GL_utility.hpp \ GL_utility.cpp \ Modified: trunk/lib/openlibraries/src/openpluginlib/pl/registry.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/registry.cpp 2007-08-18 19:45:10 UTC (rev 253) +++ trunk/lib/openlibraries/src/openpluginlib/pl/registry.cpp 2007-08-19 11:06:26 UTC (rev 254) @@ -25,6 +25,7 @@ #include <openpluginlib/pl/registry.hpp> #include <openpluginlib/pl/utf8_utils.hpp> #include <openpluginlib/pl/opl_importer.hpp> +#include <openpluginlib/pl/shlib.hpp> namespace fs = boost::filesystem; @@ -32,54 +33,7 @@ namespace { - // Code replication due to OFX. There are some - // differences in how OFX plugins are specified. - // Refactoring is left as an exercise to the reader. #ifdef WIN32 - typedef HMODULE module_t; - HMODULE dlopen_( const char* path ) -#elif defined __APPLE__ - typedef CFBundleRef module_t; - CFBundleRef dlopen_( const char* path ) -#else - typedef void* module_t; - void* dlopen_( const char* path ) -#endif - { -#ifdef WIN32 - return LoadLibrary( to_wstring( path ).c_str( ) ); -#elif defined __APPLE__ - CFStringRef bundle_str = CFStringCreateWithCString( kCFAllocatorDefault, path, kCFStringEncodingASCII ); - CFURLRef url_ref = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, bundle_str, kCFURLPOSIXPathStyle, true ); - - CFBundleRef bundle = CFBundleCreate( kCFAllocatorDefault, url_ref ); - - CFRelease( url_ref ); - CFRelease( bundle_str ); - - return bundle; -#else - return dlopen( path, RTLD_GLOBAL | RTLD_NOW ); -#endif - } - - void* dlsym_( module_t shared, const char* entry_point ) - { -#ifdef WIN32 - return GetProcAddress( shared, entry_point ); -#elif defined __APPLE__ - CFStringRef entry_str = CFStringCreateWithCString( kCFAllocatorDefault, entry_point, kCFStringEncodingASCII ); - - void* entry = CFBundleGetFunctionPointerForName( shared, entry_str ); - CFRelease( entry_str ); - - return entry; -#else - return dlsym( shared, entry_point ); -#endif - } - -#ifdef WIN32 // Replicate some of OFX types on Win32 to avoid an include dependency. // In the unlikely event that they will change then this will have to be // updated. Added: trunk/lib/openlibraries/src/openpluginlib/pl/shlib.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/shlib.cpp (rev 0) +++ trunk/lib/openlibraries/src/openpluginlib/pl/shlib.cpp 2007-08-19 11:06:26 UTC (rev 254) @@ -0,0 +1,70 @@ + +// HDRFlow - A image processing application + +// Copyright (c) 2007 Goncalo N. M. de Carvalho +// Released under the LGPL. +// For more information, see http://www.cryogenicgraphics.com/hdrflow. + +#ifdef HAVE_CONFIG_H +#include <openlibraries_global_config.hpp> +#endif + +#ifdef __APPLE__ +#include <CoreFoundation/CoreFoundation.h> +#endif + +#include <openpluginlib/pl/shlib.hpp> + +namespace olib { namespace openpluginlib { + +// Code replication due to OFX. There are some +// differences in how OFX plugins are specified. +// Refactoring is left as an exercise to the reader. + +module_t dlopen_( const char* path ) +{ +#ifdef WIN32 + return LoadLibrary( to_wstring( path ).c_str( ) ); +#elif defined __APPLE__ + CFStringRef bundle_str = CFStringCreateWithCString( kCFAllocatorDefault, path, kCFStringEncodingASCII ); + CFURLRef url_ref = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, bundle_str, kCFURLPOSIXPathStyle, true ); + + CFBundleRef bundle = CFBundleCreate( kCFAllocatorDefault, url_ref ); + + CFRelease( url_ref ); + CFRelease( bundle_str ); + + return bundle; +#else + return dlopen( path, RTLD_GLOBAL | RTLD_NOW ); +#endif +} + +void* dlsym_( module_t shared, const char* entry_point ) +{ +#ifdef WIN32 + return GetProcAddress( shared, entry_point ); +#elif defined __APPLE__ + CFStringRef entry_str = CFStringCreateWithCString( kCFAllocatorDefault, entry_point, kCFStringEncodingASCII ); + + void* entry = CFBundleGetFunctionPointerForName( shared, entry_str ); + CFRelease( entry_str ); + + return entry; +#else + return dlsym( shared, entry_point ); +#endif +} + +void dlclose_( module_t module ) +{ +#ifdef WIN32 + FreeLibrary( module ); +#elif defined __APPLE__ + CFRelease( module ); +#else + dlclose( module ); +#endif +} + +} } Added: trunk/lib/openlibraries/src/openpluginlib/pl/shlib.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/shlib.hpp (rev 0) +++ trunk/lib/openlibraries/src/openpluginlib/pl/shlib.hpp 2007-08-19 11:06:26 UTC (rev 254) @@ -0,0 +1,27 @@ + +// HDRFlow - A image processing application + +// Copyright (c) 2007 Goncalo N. M. de Carvalho +// Released under the LGPL. +// For more information, see http://www.cryogenicgraphics.com/hdrflow. + +#ifndef SHLIB_INC_ +#define SHLIB_INC_ + +namespace olib { namespace openpluginlib { + +#ifdef WIN32 +typedef HMODULE module_t; +#elif defined __APPLE__ +typedef CFBundleRef module_t; +#else +typedef void* module_t; +#endif + +module_t dlopen_( const char* path ); +void* dlsym_( module_t shared, const char* entry_point ); +void dlclose_( module_t module ); + +} } + +#endif Modified: trunk/unity.sh =================================================================== --- trunk/unity.sh 2007-08-18 19:45:10 UTC (rev 253) +++ trunk/unity.sh 2007-08-19 11:06:26 UTC (rev 254) @@ -39,7 +39,7 @@ output_directory="." -openlibraries_configure_options= "--with-boostprefix=/usr/local --with-boostversion=1_34_1 --with-pythonversion=2.3 --with-boostthreadruntime=mt --enable-universalbinaries --disable-dependency-tracking --with-glewprefix=/usr/local" +openlibraries_configure_options="--with-boostprefix=/usr/local --with-boostversion=1_34_1 --with-pythonversion=2.3 --with-boostthreadruntime=mt --enable-universalbinaries --disable-dependency-tracking --with-glewprefix=/usr/local" extras_configure_options="--with-boostprefix=/usr/local --with-boostversion=1_34_1 --with-boostthreadruntime=mt --enable-universalbinaries --disable-dependency-tracking" while getopts "v:b:efi:o:x:upas" option This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |