A
Alan
Good afternoon,
I'm having difficulties loading a dll in Microsoft Visual Studio 2003,
that was supplied to me by another company. They have supplied me with
test code, which causes my program to crash, see below:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#include <windows.h>
typedef bool (__fastcall* _ANT_Init)(unsigned char ucUSB_, unsigned
short usBaud_);
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hDLLInstance;
_ANT_Init ANT_Init;
printf("Attempting to load DLL\n");
hDLLInstance = LoadLibraryA("ANT_DLL.dll");
if (hDLLInstance == NULL)
{
fprintf(stderr, "ERROR: Unable to load DLL\n");
return 1;
}
else
{
printf("Success: Loaded ANT_DLL.dll\n");
}
ANT_Init = (_ANT_Init)GetProcAddress(hDLLInstance, "_ANT_Init");
if (ANT_Init(0, 50000) == true)
{
printf("Success: ANT Initialized Properly\n");
}
else
{
printf("Fail: ANT Interface not found\n");
}
FreeLibrary(hDLLInstance);
printf("ANT DLL Freed\n");
return 0;
}
Whenever my program crashes, I get the following error message
"Unhandled exception at 0x00000000 in program.exe: 0xC0000005: Access
violation reading location 0x00000000."
The company that supplied me, with the dll, say that they compiled it,
with Borland C++. They also told me that to get my program to link the
windows.h file in properly, that I need to have Windows PSDK installed
.. I've downloaded the latter of the Microsoft web site, but I still get
the same error. From the following screen shot, you can see, that SDK
seems to be installed correctly on my computer.
Do you have any suggestions? Thanks in advance for your help,
Regards,
Alan
I'm having difficulties loading a dll in Microsoft Visual Studio 2003,
that was supplied to me by another company. They have supplied me with
test code, which causes my program to crash, see below:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#include <windows.h>
typedef bool (__fastcall* _ANT_Init)(unsigned char ucUSB_, unsigned
short usBaud_);
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hDLLInstance;
_ANT_Init ANT_Init;
printf("Attempting to load DLL\n");
hDLLInstance = LoadLibraryA("ANT_DLL.dll");
if (hDLLInstance == NULL)
{
fprintf(stderr, "ERROR: Unable to load DLL\n");
return 1;
}
else
{
printf("Success: Loaded ANT_DLL.dll\n");
}
ANT_Init = (_ANT_Init)GetProcAddress(hDLLInstance, "_ANT_Init");
if (ANT_Init(0, 50000) == true)
{
printf("Success: ANT Initialized Properly\n");
}
else
{
printf("Fail: ANT Interface not found\n");
}
FreeLibrary(hDLLInstance);
printf("ANT DLL Freed\n");
return 0;
}
Whenever my program crashes, I get the following error message
"Unhandled exception at 0x00000000 in program.exe: 0xC0000005: Access
violation reading location 0x00000000."
The company that supplied me, with the dll, say that they compiled it,
with Borland C++. They also told me that to get my program to link the
windows.h file in properly, that I need to have Windows PSDK installed
.. I've downloaded the latter of the Microsoft web site, but I still get
the same error. From the following screen shot, you can see, that SDK
seems to be installed correctly on my computer.
Do you have any suggestions? Thanks in advance for your help,
Regards,
Alan