I am working on a project where I am creating a small DLL and then also creating a windows application to use it.
I can not figure out what is going on.
I have a function in the DLL called "startPicadorVisual" which takes one parameter which is a std::string.
In the application which is dependent on the DLL I have the following code in a mostly auto-generated .h file:
typedef void (__stdcall *f_startPicadorVisual)(string s);
namespace PicadorPrototype {
f_startPicadorVisual startPicadorVisual;
Form1(void) {
//Load DLL Funcs
HINSTANCE hGetProcIDDLL = LoadLibrary(L"..\\Debug\\Picador.dll");
if (!hGetProcIDDLL) {
std::cout << "could not load the dynamic library" << std::endl;
throw "Bad Stuff";
}
startPicadorVisual = (f_startPicadorVisual)GetProcAddress(hGetProcIDDLL, "startPicadorVisual");
if (!startPicadorVisual) {
std::cout << "could not locate the function" << std::endl;
throw "More Bad Stuff";
}
When which fails on the second step when I call GetProcAddress.
The functions are defined as follows in my DLL:
void __declspec(dllexport) startPicadorVisual(string fixtureNamet);
PicadorResults __declspec(dllexport) getPicadorReading(string fixtureName);
Can anyone tell me why this isn't working?