| 2259 | } |
| 2260 | |
| 2261 | Result<void*> LoadDynamicLibrary(const char* path) { |
| 2262 | #ifdef _WIN32 |
| 2263 | ARROW_ASSIGN_OR_RAISE(auto platform_path, PlatformFilename::FromString(path)); |
| 2264 | return LoadDynamicLibrary(platform_path); |
| 2265 | #else |
| 2266 | constexpr int kFlags = |
| 2267 | // All undefined symbols in the shared object are resolved before dlopen() returns. |
| 2268 | RTLD_NOW |
| 2269 | // Symbols defined in this shared object are not made available to |
| 2270 | // resolve references in subsequently loaded shared objects. |
| 2271 | | RTLD_LOCAL; |
| 2272 | if (void* handle = dlopen(path, kFlags)) return handle; |
| 2273 | // dlopen(3) man page: "If dlopen() fails for any reason, it returns NULL." |
| 2274 | // There is no null-returning non-error condition. |
| 2275 | auto* error = dlerror(); |
| 2276 | return Status::IOError("dlopen(", path, ") failed: ", error ? error : "unknown error"); |
| 2277 | #endif |
| 2278 | } |
| 2279 | |
| 2280 | Result<void*> LoadDynamicLibrary(const PlatformFilename& path) { |
| 2281 | #ifdef _WIN32 |
no test coverage detected