Download ggml/src/ggml-opencl/libdl.h from Brunobkr/llama.cpp_AlgMor24_github: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github/resolve/main/ggml/src/ggml-opencl/libdl.h
- Command line
-
hf download hf://datasets/Brunobkr/llama.cpp_AlgMor24_github/ggml/src/ggml-opencl/libdl.h
-
curl -L -o libdl.h https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github/resolve/main/ggml/src/ggml-opencl/libdl.h
1.66 kB
| namespace fs = std::filesystem; | |
| using dl_handle = std::remove_pointer_t<HMODULE>; | |
| struct dl_handle_deleter { | |
| void operator()(HMODULE handle) { | |
| FreeLibrary(handle); | |
| } | |
| }; | |
| static inline dl_handle * dl_load_library(const fs::path & path) { | |
| // suppress error dialogs for missing DLLs | |
| DWORD old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); | |
| SetErrorMode(old_mode | SEM_FAILCRITICALERRORS); | |
| HMODULE handle = LoadLibraryW(path.wstring().c_str()); | |
| SetErrorMode(old_mode); | |
| return handle; | |
| } | |
| static inline void * dl_get_sym(dl_handle * handle, const char * name) { | |
| DWORD old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); | |
| SetErrorMode(old_mode | SEM_FAILCRITICALERRORS); | |
| void * p = (void *) GetProcAddress(handle, name); | |
| SetErrorMode(old_mode); | |
| return p; | |
| } | |
| static inline const char * dl_error() { | |
| return ""; | |
| } | |
| using dl_handle = void; | |
| struct dl_handle_deleter { | |
| void operator()(void * handle) { | |
| dlclose(handle); | |
| } | |
| }; | |
| static inline dl_handle * dl_load_library(const fs::path & path) { | |
| dl_handle * handle = dlopen(path.string().c_str(), RTLD_NOW | RTLD_LOCAL); | |
| return handle; | |
| } | |
| static inline void * dl_get_sym(dl_handle * handle, const char * name) { | |
| return dlsym(handle, name); | |
| } | |
| static inline const char * dl_error() { | |
| const char *rslt = dlerror(); | |
| return rslt != nullptr ? rslt : ""; | |
| } | |