MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / Unload

Method Unload

framework/src/util/SharedLibrary.cpp:142–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140 }
141
142 void
143 SharedLibrary::Unload()
144 {
145 if (d->m_Handle)
146 {
147#ifdef US_PLATFORM_POSIX
148 if (dlclose(d->m_Handle))
149 {
150 std::string err_msg = "Error unloading " + GetLibraryPath() + ".";
151 char const* err = dlerror();
152 if (err)
153 {
154 err_msg += " " + std::string(err);
155 }
156
157 d->m_Handle = nullptr;
158 throw std::runtime_error(err_msg);
159 }
160#else
161 if (!FreeLibrary(reinterpret_cast<HMODULE>(d->m_Handle)))
162 {
163 std::string errMsg = "Unloading ";
164 errMsg.append(GetLibraryPath()).append("failed with error: ").append(util::GetLastWin32ErrorStr());
165
166 d->m_Handle = nullptr;
167 throw std::runtime_error(errMsg);
168 }
169#endif
170
171 d->m_Handle = nullptr;
172 }
173 }
174
175 void
176 SharedLibrary::SetName(std::string const& name)

Callers 2

TEST_FFunction · 0.80
TESTFunction · 0.80

Calls 2

dlerrorFunction · 0.85
GetLastWin32ErrorStrFunction · 0.85

Tested by 2

TEST_FFunction · 0.64
TESTFunction · 0.64