Permalink
Browse files

Display error message from Windows in case VST DLL cannot be loaded. …

…This helps slightly with a more informative error message.
  • Loading branch information...
1 parent 0d4dff3 commit bf1e54a89b96dd10a3202f56847ae0a9ba013cc4 @mhroth committed Jan 7, 2010
Showing with 7 additions and 1 deletion.
  1. BIN jvsthost2.dll
  2. +7 −1 src/com/synthbot/audioplugin/vst/vst2/JVstHost.cpp
View
Binary file not shown.
@@ -830,9 +830,15 @@ JNIEXPORT jlong JNICALL Java_com_synthbot_audioplugin_vst_vst2_JVstHost2_loadPlu
}
libptr = LoadLibrary (path);
if (libptr == NULL) {
+ DWORD errorCode = GetLastError(); // get error code
+ // get string representation of error code
+ LPTSTR errorString = NULL;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, errorCode, NULL, (LPTSTR) &errorString, 0, NULL);
env->ThrowNew(
env->FindClass("com/synthbot/audioplugin/vst/JVstLoadException"),
- "The native VST library could not be loaded.");
+ errorString); // "The native VST library could not be loaded."
+ LocalFree(errorString); // free the error string
return 0;
}
env->ReleaseStringUTFChars(pluginPath, path);

0 comments on commit bf1e54a

Please sign in to comment.