MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLLibraryHelper Class Reference

Detailed Description

This class provides a platform independent way of loading and querying a Shared Library for functions.

The user of this class is still responsible for ensuring the method name is correctly defined (C++ mangling) and that the function is used correctly.

Public Types

typedef void * LibraryHandle
 

Static Public Member Functions

static bool freeLibrary (LibraryHandle libraryHandle)
 
static void * getFunctionAddress (LibraryHandle libraryHandle, const char *functionName)
 
static LibraryHandle loadLibrary (const char *libraryName)
 

Member Typedef Documentation

◆ LibraryHandle

Platform specific handle to a shared library.

Member Function Documentation

◆ freeLibrary()

static bool TSLLibraryHelper::freeLibrary ( LibraryHandle libraryHandle)
static

This method closes the library referenced by libraryHandle.

Parameters
libraryHandleA library handle returned by a call to loadLibrary.
Returns
true if the library was freed, false otherwise.

◆ getFunctionAddress()

static void * TSLLibraryHelper::getFunctionAddress ( LibraryHandle libraryHandle,
const char * functionName )
static

This method returns the function address for the requested function.

The user is responsible for making sure the function name passed matches the representation in the shared library.

The simplest approach to ensure this is to make sure that the functions are declared 'extern "C"'. C++ compilers may generate different mangled names from each other.

Parameters
libraryHandlethe library handle returned by a call to loadLibrary.
functionNamethe function name to lookup in the shared library.
Returns
the pointer to the function or NULL if an error occurred.

◆ loadLibrary()

static LibraryHandle TSLLibraryHelper::loadLibrary ( const char * libraryName)
static

This method opens the 'libraryName' and returns a platform specific library handle.

To close/unload the library call freeLibrary.

Parameters
libraryNamethe shared library to open
Returns
a library handle or NULL if the library could not be found or opened.