Hi guys,
I'm going absolutely mad trying to get my function pointers to work correctly - I can load the DLL, but the function pointers always return an unused value no matter what I do with them, or how I rewrite them. You're looking at many, many hours of frustration, reading, debugging, experimenting and generally getting nowhere.
Here's a version with the unecessary gubbins thrown out;
Usage (directory and functionName are appropriate and correct strings)
HINSTANCE hinstLib;
hinstLib = LoadLibrary(directory);
DWORD error = GetLastError();
typedef string(*GetString)();
GetString getString = (GetString)GetProcAddress(hinstLib, functionName);
DLL Header
#ifndef ASEXPORT
#define DLLIMPORTOREXPORT dllimport
#else
#define DLLIMPORTOREXPORT dllexport
#endif
extern "C"__declspec(dllexport) string GetString();
Not that GetLastError returns 0 (completed successfully).
Any ideas on what I should be looking at? I've tried writing this in quite a few different ways, so there must be something fundamentally wrong somewhere.