Okay, now I at least have a new angle on the problem. I finally got a test program constructed that does nothing but call the function. I ran it in debug mode and got an 'access violation' error. I have a nagging suspicion that that has something to do with multithreading. If that's the case, what did I do wrong?
Exception:
Code:
Unhandled exception at 0x00000000 in TestApp.exe: 0xC0000005: Access violation reading location 0x00000000.
TestApp.cpp:
Code:
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
/* get handle to dll */
HINSTANCE hGetProcIDDLL = LoadLibrary((LPCWSTR)"D:\\Coding\\C++ Projects\\LabIce_DLL1\\debug\\LabIce_DLL1.dll");
/* get pointer to the function in the dll*/
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE(hGetProcIDDLL), "LabIce_PrintLong");
/*
Define the Function in the DLL for reuse. This is just prototyping
the dll's function. A mock of it. Use "stdcall" for maximum
compatibility.
*/
typedef void (__stdcall * pICFUNC)(unsigned long);
pICFUNC LPrintLong;
LPrintLong = pICFUNC(lpfnGetProcessID);
/* The actual call to the function contained in the dll */
LPrintLong((unsigned long)200);
/* Release the Dll */
FreeLibrary(hGetProcIDDLL);
}