Commit b1cffecf authored by Michael Sherman's avatar Michael Sherman
Browse files

(1) Made Platform::loadPluginLibrary() for Windows leave the end user alone if...

(1) Made Platform::loadPluginLibrary() for Windows leave the end user alone if a failure occurs -- was throwing up an error box.
(2) Made Platform::loadPluginsFromDirectory() on Windows find only .dll's. 
parent 1775e497
......@@ -141,7 +141,10 @@ Platform& Platform::findPlatform(vector<string> kernelNames) {
void Platform::loadPluginLibrary(string file) {
#ifdef WIN32
// Tell Windows not to bother the user with ugly error boxes.
const UINT oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
HMODULE handle = LoadLibrary(file.c_str());
SetErrorMode(oldErrorMode); // Restore previous error mode.
if (handle == NULL) {
string message;
stringstream(message) << "Error loading library " << file << ": " << GetLastError();
......@@ -157,10 +160,10 @@ void Platform::loadPluginLibrary(string file) {
vector<string> Platform::loadPluginsFromDirectory(string directory) {
vector<string> files;
char dirSeparator;
#ifdef _MSC_VER
#ifdef WIN32
dirSeparator = '\\';
WIN32_FIND_DATA fileInfo;
string filePattern(directory + dirSeparator + "*");
string filePattern(directory + dirSeparator + "*.dll");
HANDLE findHandle = FindFirstFile(filePattern.c_str(), &fileInfo);
if (findHandle != INVALID_HANDLE_VALUE) {
do {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment