MCPcopy Create free account
hub / github.com/IoLanguage/io / DynLib_close

Function DynLib_close

libs/basekit/source/DynLib.c:153–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151unsigned char DynLib_isOpen(DynLib *self) { return self->handle != NULL; }
152
153void DynLib_close(DynLib *self) {
154 if (self->freeFuncName) {
155 void *f = DynLib_pointerForSymbolName_(self, self->freeFuncName);
156
157 if (!f) {
158 DynLib_setError_(self, "io_free function not found");
159 return;
160 }
161
162 if (self->freeArg) {
163 (*(DynLibOneArgFunction *)f)(self->freeArg);
164 } else {
165 (*(DynLibNoArgFunction *)f)();
166 }
167 }
168
169 if (self->handle) {
170 dlclose(self->handle);
171 }
172
173 self->handle = NULL;
174}
175
176void *DynLib_pointerForSymbolName_(DynLib *self, const char *symbolName) {
177 DynLib_setError_(self, dlerror());

Callers 1

IoDynLib_closeFunction · 0.85

Calls 3

DynLib_setError_Function · 0.85
dlcloseFunction · 0.85

Tested by

no test coverage detected