MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / LoadSharedLibrary

Function LoadSharedLibrary

src/include/sharedLibrary.h:32–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#endif
31
32inline void* LoadSharedLibrary( std::string unixPrefix, std::string libraryName, bool quiet )
33{
34#if defined( _WIN32 )
35 libraryName += ".dll";
36
37 // HMODULE is actually the load address; function returns NULL if it cannot find the shared library
38 HMODULE fileHandle = ::LoadLibraryExA( libraryName.c_str( ), NULL, NULL );
39#elif defined(__linux__)
40 tstring linuxName = unixPrefix;
41 linuxName += libraryName += ".so";
42 void* fileHandle = ::dlopen( linuxName.c_str( ), RTLD_NOW );
43 if( !quiet && !fileHandle )
44 {
45 std::cerr << ::dlerror( ) << std::endl;
46 }
47#elif defined(__APPLE__)
48 tstring appleName = unixPrefix;
49 appleName += libraryName += ".dylib";
50 void* fileHandle = ::dlopen( appleName.c_str( ), RTLD_NOW );
51 if( !quiet && !fileHandle )
52 {
53 std::cerr << ::dlerror( ) << std::endl;
54 }
55#elif defined(__FreeBSD_kernel__)
56 tstring freebsdName = unixPrefix;
57 freebsdName += libraryName += ".so";
58 void* fileHandle = ::dlopen( freebsdName.c_str( ), RTLD_NOW );
59 if( !quiet && !fileHandle )
60 {
61 std::cerr << ::dlerror( ) << std::endl;
62 }
63#else
64 #error "unsupported platform"
65#endif
66
67 return fileHandle;
68}
69
70// If the function succeeds, the return value is nonzero.
71// If the function fails, the return value is zero.

Callers 2

clfftSetupFunction · 0.85
transformFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected