47 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS 51 lName = lPath +
"/" + lName;
59 std::cout << std::endl <<
"Shared library " << l1.
getFileName() <<
" loaded!" << std::endl;
67 std::cout <<
"Function fatorial found!" << std::endl;
71 std::cout <<
"Function fatorial not found!" << std::endl;
75 typedef int (*fatorial_fptr)(
int);
77 fatorial_fptr fat =
reinterpret_cast<fatorial_fptr
>(t);
79 std::cout <<
"Fatorial 5: " << fat(5) << std::endl;
84 std::cout <<
"Library unloaded!" << std::endl << std::endl;
88 if(
const std::string*
d = boost::get_error_info<te::ErrorDescription>(e))
89 std::cout << std::endl <<
"Fail to load library: " << *
d;
95 if(
const std::string*
d = boost::get_error_info<te::ErrorDescription>(e))
96 std::cout << std::endl <<
"Fail to unload library: " << *
d;
102 if(
const std::string*
d = boost::get_error_info<te::ErrorDescription>(e))
103 std::cout << std::endl <<
"Fail to load symbol: " << *
d;
109 if(
const std::string*
d = boost::get_error_info<te::ErrorDescription>(e))
110 std::cout << std::endl <<
"Unknown error: " << *
d;
114 catch(
const std::exception& e)
116 std::cout << std::endl <<
"Unknown error: " << e.what();
121 std::cout << std::endl <<
"Unknown error!";
A class for handling shared libraries.
An exception indicating an error when loading a shared library.
Base exception class for plugin module.
An exception indicating an error when releasing a shared library.
Specific exception types for Library Manager.
static void addSearchDir(const std::string &dir_name)
Add the informed dir to the path used by the operational system to lookup for shared libraries...
void unload()
Force the unload of the shared library from memory.
A class for handling shared libraries (DLLs, SO, DyLibs).
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
void * getAddress(const char *symbol) const
Return the address where the given symbol is loaded into memory.
const std::string & getFileName() const
Return the shared library file name as informed in the constructor.
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
An exception indicating an error when searching for a given symbol in a shared library.
bool isLoaded() const
Return true if the shared library is loaded otherwise return false.
static std::string getNativeName(const std::string &name)
Given a shared library name without file extensions, prefixes and nor suffixes it will construct a li...