//Source.cpp
extern "C"
__declspec(dllexport) int Sum(int a, int b) {
return a + b;
}
//main.cpp
HMODULE hModule = GetModuleHandle(NULL);
typedef int (*DLLFunc)(int, int);
DLLFunc func = (DLLFunc)GetProcAddress(hModule, "Sum");
int c = func(4, 5);
func is 0x00000000
UPD: There is no export table as well Also, optimizations are turned off, debug mode.
GetLastError gives 127 - "The specified procedure could not be found. "
User contributions licensed under CC BY-SA 3.0