char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
ce38a4db4
char/aliceai-t5-moe
1#include "ggml-backend-dl.h" 2 3#ifdef _WIN32 4 5dl_handle * dl_load_library (const fs::path & path ) { 6// suppress error dialogs for missing DLLs 7DWORD old_mode = SetErrorMode (SEM_FAILCRITICALERRORS ); 8SetErrorMode (old_mode |SEM_FAILCRITICALERRORS ); 9 10HMODULE handle = LoadLibraryW (path .wstring ().c_str ()); 11 12SetErrorMode (old_mode ); 13 14return handle ; 15} 16 17void * dl_get_sym (dl_handle * handle ,const char * name ) { 18DWORD old_mode = SetErrorMode (SEM_FAILCRITICALERRORS ); 19SetErrorMode (old_mode |SEM_FAILCRITICALERRORS ); 20 21void * p = (void * )GetProcAddress (handle ,name ); 22 23SetErrorMode (old_mode ); 24 25return p ; 26} 27 28const char * dl_error () { 29return "" ; 30} 31 32#else 33 34dl_handle * dl_load_library (const fs::path & path ) { 35dl_handle * handle = dlopen (path .string ().c_str (),RTLD_NOW |RTLD_LOCAL ); 36return handle ; 37} 38 39void * dl_get_sym (dl_handle * handle ,const char * name ) { 40return dlsym (handle ,name ); 41} 42 43const char * dl_error () { 44const char * rslt = dlerror (); 45return rslt != nullptr ?rslt :"" ; 46} 47 48#endif