Re: Problems calling a function in a DLL
shanzer wrote:
I have writtin some code to call a function inside a DLL.
I use LoadLibrary to load the DLL, I call GetProcAddress to get the address
of the function, and then I call the function. The function returns with out
a problem, and it does all the work (one of the arguments is a buffer which
the function fills in, another is a pointer to an int which contains the
amount of data filled in).
How ever right after I step out of the function I get a "user breakpoint
called from code ...". What did I miss?
Below is the code:
#include <windows.h>
#include <stdio.h>
main()
{
HINSTANCE sdll = LoadLibrary("testme.dll");
if (sdll == 0) {
fprintf(stderr, "Failed to load password seed module\n");
exit(-1);
}
typedef DWORD (WINAPI *tfn) (unsigned char *, unsigned int, unsigned int *);
Specify WINAPI in the DLL function declaration too, so the function
calling convention will match what your typedef assumes.
--
Scott McPhillips [VC++ MVP]