MCPcopy Create free account
hub / github.com/apache/arrow / GetSymbol

Function GetSymbol

cpp/src/arrow/util/io_util.cc:2293–2313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2291}
2292
2293Result<void*> GetSymbol(void* handle, const char* name) {
2294 if (handle == nullptr) {
2295 return Status::Invalid("Attempting to retrieve symbol '", name,
2296 "' from null library handle");
2297 }
2298#ifdef _WIN32
2299 if (void* sym = reinterpret_cast<void*>(
2300 GetProcAddress(reinterpret_cast<HMODULE>(handle), name))) {
2301 return sym;
2302 }
2303 // win32 api doc: "If the function fails, the return value is NULL."
2304 // There is no null-returning non-error condition.
2305 return IOErrorFromWinError(GetLastError(), "GetProcAddress(", name, ") failed.");
2306#else
2307 if (void* sym = dlsym(handle, name)) return sym;
2308 // dlsym(3) man page: "On failure, they return NULL"
2309 // There is no null-returning non-error condition.
2310 auto* error = dlerror();
2311 return Status::IOError("dlsym(", name, ") failed: ", error ? error : "unknown error");
2312#endif
2313}
2314
2315} // namespace arrow::internal

Callers

nothing calls this directly

Calls 3

IOErrorFromWinErrorFunction · 0.85
IOErrorFunction · 0.85
InvalidFunction · 0.50

Tested by

no test coverage detected