This takes a shared module handle returned from LoadSharedLibrary, and a text string of a symbol to load from the module, and returns a pointer to that symbol. If the symbol is not found, NULL is returned. If the module handle is NULL, NULL is returned.
| 90 | // to load from the module, and returns a pointer to that symbol. If the symbol is not found, NULL |
| 91 | // is returned. If the module handle is NULL, NULL is returned. |
| 92 | inline void* LoadFunctionAddr( void* libHandle, std::string funcName ) |
| 93 | { |
| 94 | if( libHandle == NULL ) |
| 95 | return NULL; |
| 96 | |
| 97 | #if defined( _WIN32 ) |
| 98 | HMODULE fileHandle = reinterpret_cast< HMODULE >( libHandle ); |
| 99 | |
| 100 | void* pFunc = reinterpret_cast< void* >( ::GetProcAddress( fileHandle, funcName.c_str( ) ) ); |
| 101 | #else |
| 102 | void* pFunc = ::dlsym( libHandle, funcName.c_str( ) ); |
| 103 | #endif |
| 104 | |
| 105 | return pFunc; |
| 106 | } |
| 107 | |
| 108 | #endif // _SHAREDLIBRARY_H_ |
no outgoing calls
no test coverage detected