| 2291 | } |
| 2292 | |
| 2293 | Result<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 |
nothing calls this directly
no test coverage detected