I am writing\compiling a DLL that(currently) only exports a blank function. Source code:
DLLMain.cpp-
LIBRARYEXPORT LRESULT CALLBACK KeyboardProc(
int code,
WPARAM wParam,
LPARAM lParam
){
return 0;
}
Everything is okay so far, and here is my DLLMain.h-
using namespace std;
#include <iostream>
#include <fstream>
#include <string>
#include <Windows.h>
#define LIBRARYEXPORT __declspec(dllexport)
LIBRARYEXPORT LRESULT CALLBACK KeyboardProc(
int code,
WPARAM wParam,
LPARAM lParam
);
I plan to use this DLL with windows hooks to detect key presses, but when I call LoadLibrary from a separate executable, it returns with a runtime error saying
"DLL 'C:\Users\Orin\Documents\Visual Studio 2010\Projects\winmain\Debug\winmain.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang."
That's great, but here's the catch: I'm not running any code at all in my KeyboardProc function, and I don't even have a DllMain routine
What I've tried(and hasn't worked):
- Disabling CLR in project properties
- Removing my "DllMain" routine
- Using '#pragma unmanaged' when declaring functions
Suggestions and comments are really appreciated!