Program: bbtk
Module: $RCSfile: bbtkPackage.cxx,v $
Language: C++
- Date: $Date: 2010/09/12 14:52:25 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2012/11/14 07:12:00 $
+ Version: $Revision: 1.36 $
=========================================================================*/
/* ---------------------------------------------------------------------
/// to test that a dyn lib is a valid bbtk package lib
/// NB : The BBTK version exported from the library
/// is tested against the current bbtk version
- DynamicLibraryHandler Package::OpenDynamicLibrary
- ( const std::string& libname,
- const std::string& package_name,
- DLGetPackageFunction& getpack,
- DLDeletePackageFunction& delpack)
+ DynamicLibraryHandler Package::OpenDynamicLibrary( const std::string& libname,const std::string& package_name,
+ DLGetPackageFunction& getpack, DLDeletePackageFunction& delpack)
{
bbtkDebugMessage("package",3,"==> Package::OpenDynamicLibrary("
<<libname<<")"<<std::endl);
if (!handler)
{
- bbtkMessage("package",2,
- "Could not open shared library [" <<libname<<"] : "
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading could not open shared library [" <<libname<<"] : "
<<dlerror() << std::endl);
return 0;
}
// Loads the Package bbtk version function
std::string getvername(package_name);
- getvername +=
- BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME);
- DLGetPackageBBTKVersionFunction getbbtkversion
- = (DLGetPackageBBTKVersionFunction)(dlsym(handler,getvername.c_str()));
+ getvername += BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME);
+ DLGetPackageBBTKVersionFunction getbbtkversion = (DLGetPackageBBTKVersionFunction)(dlsym(handler,getvername.c_str()));
if (!getbbtkversion)
{
bbtkDebugMessage("package",3,"***"<<std::endl);
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading shared library ["<<libname
<<"] is not a valid bbtk package."
<<" Symbol ["<<getvername<<"] :"<<dlerror()<< std::endl);
dlclose(handler);
// version matches ?
if (getbbtkversion() != bbtk::GetVersion())
{
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading: "<<package_name
+ <<" - Shared library ["<<libname
<<"] was build with bbtk version "
<<getbbtkversion()
<<" but the current program runs with version "
- <<bbtk::GetVersion()<<" : cannot load it"<<std::endl);
+ <<bbtk::GetVersion()<<" : cannot load it. You have to recompile your BBTK-Package."<<std::endl);
dlclose(handler);
return 0;
getpack = (DLGetPackageFunction)(dlsym(handler, getpackname.c_str()));
if (!getpack)
{
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading shared library ["<<libname
<<"] is not a valid bbtk package."
<<" Symbol ["<<getpackname<<"] :"<<dlerror()<< std::endl);
dlclose(handler);
delpack = (DLDeletePackageFunction)(dlsym(handler, delpackname.c_str()));
if (!delpack)
{
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading shared library ["<<libname
<<"] is not a valid bbtk package."
<<" Symbol ["<<delpackname<<"] :"<<dlerror()<< std::endl);
dlclose(handler);
handler = LoadLibrary(libname.c_str());
if (!handler)
{
- bbtkMessage("package",2,
- "Could not open shared library [" <<libname<<"]"
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. could not open shared library [" <<libname<<"]"
<< std::endl);
DWORD dwErrorCode = 0;
dwErrorCode = GetLastError();
// Loads the Package bbtk version function
std::string getvername(package_name);
- getvername +=
- BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME);
- DLGetPackageBBTKVersionFunction getbbtkversion
- = (DLGetPackageBBTKVersionFunction)(GetProcAddress(handler,
- getvername.c_str()));
+ getvername += BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME);
+ DLGetPackageBBTKVersionFunction getbbtkversion = (DLGetPackageBBTKVersionFunction)(GetProcAddress(handler, getvername.c_str()));
+
if (!getbbtkversion)
{
FreeLibrary(handler);
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading shared library ["<<libname
<<"] is not a valid bbtk package."
<<" Symbol ["<<getbbtkversion<<"] not found"<< std::endl);
return 0;
// version matches ?
if (getbbtkversion() != bbtk::GetVersion())
{
- FreeLibrary(handler);
- bbtkMessage("package",2,
- "Shared library ["<<libname
- <<"] was build with bbtk version "
- <<getbbtkversion()
- <<" but the current program runs with version "
- <<bbtk::GetVersion()<<" : cannot load it"<<std::endl);
- return 0;
-
+ FreeLibrary(handler);
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading: "<<package_name
+ <<" - Shared library ["<<libname
+ <<"] was build with bbtk version "
+ <<getbbtkversion()
+ <<" but the current program runs with version "
+ <<bbtk::GetVersion()<<" : cannot load it. You have to recompile your BBTK-Package."<<std::endl);
+ return 0;
}
// Loads the Package get function
if (!getpack)
{
FreeLibrary(handler);
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading shared library ["<<libname
<<"] is not a valid bbtk package."
<<" Symbol ["<<getpackname<<"] not found"<< std::endl);
return 0;
if (!delpack)
{
FreeLibrary(handler);
- bbtkMessage("package",2,
- "Shared library ["<<libname
+ bbtkMessage("package",0,
+ "BBTK ..ERROR.. loading shared library ["<<libname
<<"] is not a valid bbtk package."
<<" Symbol ["<<delpackname<<"] not found"<< std::endl);
return 0;
}
//==========================================================================
-//ups4 EED borrame
bool Package::ifBoxExist( std::string type)
{
bool ok=false;