| 1 | #cxx . . $ `<file>/external/whispercpp/ggml-backend-dl.cpp`/include "ggml-backend-dl.h"cxx . . $ `<file>/external/whispercpp/ggml-backend-dl.h`/ |
| 2 | |
| 3 | #ifdef _WIN32 |
| 4 | |
| 5 | dl_handle * dl_load_library(const fs::path & path) { |
| 6 | // suppress error dialogs for missing DLLs |
| 7 | DWORD old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); |
| 8 | SetErrorMode(old_mode | SEM_FAILCRITICALERRORS); |
| 9 | |
| 10 | HMODULE handle = LoadLibraryW(path.wstring().c_str()); |
| 11 | |
| 12 | SetErrorMode(old_mode); |
| 13 | |
| 14 | return handle; |
| 15 | } |
| 16 | |
| 17 | void * dl_get_sym(dl_handle * handle, const char * name) { |
| 18 | DWORD old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); |
| 19 | SetErrorMode(old_mode | SEM_FAILCRITICALERRORS); |
| 20 | |
| 21 | void * p = (void *) GetProcAddress(handle, name); |
| 22 | |
| 23 | SetErrorMode(old_mode); |
| 24 | |
| 25 | return p; |
| 26 | } |
| 27 | |
| 28 | const char * dl_error() { |
| 29 | return ""; |
| 30 | } |
| 31 | |
| 32 | #else |
| 33 | |
| 34 | dl_handlecxx . . $ dl_handle# * dl_load_librarycxx . . $ dl_load_library(c59277d6bedb3fff).(const fs::pathcxx . . $ std/filesystem/__cxx11/path# & path) { |
| 35 | dl_handlecxx . . $ dl_handle# * handle = dlopen(path.stringcxx . . $ std/filesystem/__cxx11/path#string(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), RTLD_NOWcxx . . $ `<external>/10632388298615623587/dlfcn.h:25:9`! | RTLD_LOCALcxx . . $ `<external>/10632388298615623587/dlfcn.h:38:9`!); |
| 36 | return handle; |
| 37 | } |
| 38 | |
| 39 | void * dl_get_symcxx . . $ dl_get_sym(5c3a2d84d269ab4b).(dl_handlecxx . . $ dl_handle# * handle, const char * name) { |
| 40 | return dlsym(handle, name); |
| 41 | } |
| 42 | |
| 43 | const char * dl_errorcxx . . $ dl_error(33a1f659e94feb42).() { |
| 44 | const char *rslt = dlerror(); |
| 45 | return rslt != nullptr ? rslt : ""; |
| 46 | } |
| 47 | |
| 48 | #endif |