"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common/os/darwin/mod_loader.cpp" between
Firebird-3.0.2.32703-0.tar.bz2 and Firebird-3.0.4.33054-0.tar.bz2

About: Firebird is a relational database offering many ANSI SQL standard features.

mod_loader.cpp  (Firebird-3.0.2.32703-0.tar.bz2):mod_loader.cpp  (Firebird-3.0.4.33054-0.tar.bz2)
skipping to change at line 31 skipping to change at line 31
* and all contributors signed below. * and all contributors signed below.
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* Paul Beach * Paul Beach
*/ */
#include "firebird.h" #include "firebird.h"
#include "../common/os/mod_loader.h" #include "../common/os/mod_loader.h"
#include "../../common.h" #include "../common/os/path_utils.h"
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
/// This is the Darwin implementation of the mod_loader abstraction. /// This is the Darwin implementation of the mod_loader abstraction.
//#define DEBUG_LOADER //#define DEBUG_LOADER
class DlfcnModule : public ModuleLoader::Module class DlfcnModule : public ModuleLoader::Module
{ {
public: public:
DlfcnModule(void* m) DlfcnModule(MemoryPool& pool, const Firebird::PathName& aFileName, void*
: module(m) m)
: ModuleLoader::Module(pool, aFileName),
module(m)
{} {}
~DlfcnModule(); ~DlfcnModule();
void* findSymbol (const Firebird::string&); void* findSymbol (const Firebird::string&);
private: private:
void* module; void* module;
}; };
bool ModuleLoader::isLoadableModule(const Firebird::PathName& module) bool ModuleLoader::isLoadableModule(const Firebird::PathName& module)
skipping to change at line 89 skipping to change at line 90
return; return;
name += ".dylib"; name += ".dylib";
} }
#ifdef DEV_BUILD #ifdef DEV_BUILD
#define FB_RTLD_MODE RTLD_NOW #define FB_RTLD_MODE RTLD_NOW
#else #else
#define FB_RTLD_MODE RTLD_LAZY #define FB_RTLD_MODE RTLD_LAZY
#endif #endif
ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath ) ModuleLoader::Module* ModuleLoader::loadModule(ISC_STATUS* status, const Firebir d::PathName& modPath)
{ {
void* module = dlopen(modPath.c_str(), FB_RTLD_MODE); void* module = dlopen(modPath.c_str(), FB_RTLD_MODE);
if (module == NULL) if (module == NULL)
{ {
#ifdef DEBUG_LOADER if (status)
fprintf(stderr, "load error: %s: %s\n", modPath.c_str(), dlerror( {
)); status[0] = isc_arg_gds;
#endif // DEBUG_LOADER status[1] = isc_random;
status[2] = isc_arg_string;
status[3] = (ISC_STATUS) dlerror();
status[4] = isc_arg_end;
}
return 0; return 0;
} }
return FB_NEW_POOL(*getDefaultMemoryPool()) DlfcnModule(module); return FB_NEW_POOL(*getDefaultMemoryPool()) DlfcnModule(*getDefaultMemory Pool(), modPath, module);
} }
DlfcnModule::~DlfcnModule() DlfcnModule::~DlfcnModule()
{ {
if (module) if (module)
dlclose(module); dlclose(module);
} }
void* DlfcnModule::findSymbol(const Firebird::string& symName) void* DlfcnModule::findSymbol(const Firebird::string& symName)
{ {
 End of changes. 5 change blocks. 
9 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)