language-extensions/R/test/src/linux/Utilities_linux.cpp
//-------------------------------------------------------------------------------------------------
// Name: Utilities::CrossPlatLoadLibrary
//
// Description:
//  Gets the handle for the given library path after loading it dynamically
//
// Returns:
//  On success, returns handle to the library. Otherwise, throws a runtime_error exception.
//
:CrossPlatLoadLibrary
Description:
Gets the handle for the given library path after loading it dynamically

On success, returns handle to the library. Otherwise, throws a runtime_error exception.
: CrossPlatLoadLibrary Description : Gets the handle for the given library path after loading it dynamically On success returns handle to the library . Otherwise throws a runtime_error exception .
void* Utilities::CrossPlatLoadLibrary(const char *libPath)
{
	void *libHandle = nullptr;
	libHandle = dlopen(libPath, RTLD_LAZY);
	if (libHandle == nullptr)
	{
		char *error = dlerror();
		string errorString("CrossPlatLoadLibrary failed loading '" + string(libPath) +
			"' with error: " + string(error));
		cout << errorString << endl;
		throw runtime_error(errorString);
	}
	return libHandle;
}
void * Utilities :: CrossPlatLoadLibrary ( const char * libPath ) { void * libHandle = nullptr ; libHandle = dlopen ( libPath , RTLD_LAZY ) ; if ( libHandle == nullptr ) { char * error = dlerror ( ) ; string errorString ( " " + string ( libPath ) + " " + string ( error ) ) ; cout << errorString << endl ; throw runtime_error ( errorString ) ; } return libHandle ; }
Name: Utilities::CrossPlatLoadLibrary
Description:
Gets the handle for the given library path after loading it dynamically
Name : Utilities :: CrossPlatLoadLibrary Description : Gets the handle for the given library path after loading it dynamically