MCPcopy Create free account
hub / github.com/MITK/MITK / Load

Method Load

Modules/CppMicroServices/src/usSharedLibrary.cpp:104–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void SharedLibrary::Load(int flags)
105{
106 if (d->m_Handle) throw std::logic_error(std::string("Library already loaded: ") + GetFilePath());
107 std::string libPath = GetFilePath();
108#ifdef US_PLATFORM_POSIX
109 d->m_Handle = dlopen(libPath.c_str(), flags);
110 if (!d->m_Handle)
111 {
112 const char* err = dlerror();
113 throw std::runtime_error(err ? std::string(err) : (std::string("Error loading ") + libPath));
114 }
115#else
116 d->m_Handle = LoadLibrary(libPath.c_str());
117 if (!d->m_Handle)
118 {
119 std::string errMsg = "Loading ";
120 errMsg.append(libPath).append("failed with error: ").append(GetLastErrorStr());
121
122 throw std::runtime_error(errMsg);
123 }
124#endif
125}
126
127void SharedLibrary::Load()
128{

Callers 1

StartMethod · 0.45

Calls 2

LoadFunction · 0.85
GetLastErrorStrFunction · 0.70

Tested by

no test coverage detected