| 1 | #cxx . . $ `<file>/external/whispercpp/ggml-backend-dl.h`/pragma once |
| 2 | |
| 3 | #ifdef _WIN32 |
| 4 | # define WIN32_LEAN_AND_MEAN |
| 5 | # ifndef NOMINMAX |
| 6 | # define NOMINMAX |
| 7 | # endif |
| 8 | # include <windows.h> |
| 9 | # include <winevt.h> |
| 10 | #else |
| 11 | # include <dlfcn.h> |
| 12 | # include <unistd.h> |
| 13 | #endif |
| 14 | #include <filesystem> |
| 15 | |
| 16 | namespace fs = stdcxx . . $ std/::filesystem; |
| 17 | |
| 18 | #ifdef _WIN32 |
| 19 | |
| 20 | using dl_handle = std::remove_pointer_t<HMODULE>; |
| 21 | |
| 22 | struct dl_handle_deleter { |
| 23 | void operator()(HMODULE handle) { |
| 24 | FreeLibrary(handle); |
| 25 | } |
| 26 | }; |
| 27 | |
| 28 | #else |
| 29 | |
| 30 | using dl_handlecxx . . $ dl_handle# = void; |
| 31 | |
| 32 | struct dl_handle_deletercxx . . $ dl_handle_deleter# { |
| 33 | void operatorcxx . . $ dl_handle_deleter#`operator()`(5d22bdacc48458e8).()(void * handle) { |
| 34 | dlclose(handle); |
| 35 | } |
| 36 | }; |
| 37 | |
| 38 | #endif |
| 39 | |
| 40 | using dl_handle_ptrcxx . . $ dl_handle_ptr# = stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<dl_handlecxx . . $ dl_handle#, dl_handle_deletercxx . . $ dl_handle_deleter#>; |
| 41 | |
| 42 | dl_handlecxx . . $ dl_handle# * dl_load_librarycxx . . $ dl_load_library(c59277d6bedb3fff).(const fs::pathcxx . . $ std/filesystem/__cxx11/path# & path); |
| 43 | void * dl_get_symcxx . . $ dl_get_sym(5c3a2d84d269ab4b).(dl_handlecxx . . $ dl_handle# * handle, const char * name); |
| 44 | const char * dl_errorcxx . . $ dl_error(33a1f659e94feb42).(); |
| 45 |