diff --git a/common/JackInternalClient.cpp b/common/JackInternalClient.cpp index bc43ec02..977150ec 100644 --- a/common/JackInternalClient.cpp +++ b/common/JackInternalClient.cpp @@ -45,6 +45,51 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. namespace Jack { +#ifdef WIN32 + +static void BuildClientPath(char* path_to_so, int path_len, const char* so_name) +{ + snprintf(path_to_so, path_len, ADDON_DIR "/%s.dll", so_name); +} + +static void PrintLoadError(const char* so_name) +{ + // Retrieve the system error message for the last-error code + LPVOID lpMsgBuf; + LPVOID lpDisplayBuf; + DWORD dw = GetLastError(); + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + // Display the error message and exit the process + lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, + (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)so_name) + 40) * sizeof(TCHAR)); + _snprintf((LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(TCHAR), + TEXT("error loading %s err = %s"), so_name, lpMsgBuf); + + jack_error((LPCTSTR)lpDisplayBuf); + + LocalFree(lpMsgBuf); + LocalFree(lpDisplayBuf); +} + +#else + +static void BuildClientPath(char* path_to_so, int path_len, const char* so_name) +{ + snprintf(path_to_so, path_len, ADDON_DIR "/%s.so", so_name); +} + +#endif + JackGraphManager* JackInternalClient::fGraphManager = NULL; JackEngineControl* JackInternalClient::fEngineControl = NULL; diff --git a/common/JackInternalClient.h b/common/JackInternalClient.h index de12cdb1..5c0231d3 100644 --- a/common/JackInternalClient.h +++ b/common/JackInternalClient.h @@ -67,40 +67,6 @@ class JackInternalClient : public JackClient #define UnloadJackModule(handle) FreeLibrary((handle)); #define GetJackProc(handle, name) GetProcAddress((handle), (name)); -static void BuildClientPath(char* path_to_so, int path_len, const char* so_name) -{ - snprintf(path_to_so, path_len, ADDON_DIR "/%s.dll", so_name); -} - -static void PrintLoadError(const char* so_name) -{ - // Retrieve the system error message for the last-error code - LPVOID lpMsgBuf; - LPVOID lpDisplayBuf; - DWORD dw = GetLastError(); - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, NULL ); - - // Display the error message and exit the process - lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, - (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)so_name) + 40) * sizeof(TCHAR)); - _snprintf((LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(TCHAR), - TEXT("error loading %s err = %s"), so_name, lpMsgBuf); - - jack_error((LPCTSTR)lpDisplayBuf); - - LocalFree(lpMsgBuf); - LocalFree(lpDisplayBuf); -} - #else #include @@ -110,11 +76,6 @@ static void PrintLoadError(const char* so_name) #define GetJackProc(handle, name) dlsym((handle), (name)); #define PrintLoadError(so_name) jack_log("error loading %s err = %s", so_name, dlerror()); -static void BuildClientPath(char* path_to_so, int path_len, const char* so_name) -{ - snprintf(path_to_so, path_len, ADDON_DIR "/%s.so", so_name); -} - #endif typedef int (*InitializeCallback)(jack_client_t*, const char*);