I have a dll written in C and a C program to call it. The C program gives a compile error "too few arguments to call function" but the function it's calling does not have any arguments.
The dll (SxSv.dll):
Code:
#define EXPORT __declspec(dllexport)
EXPORT int SSV ();
__declspec(dllexport) int __stdcall SSXV()
{
int n = 0;
while(n < 500000){
n += 1;
}
return n;
}
The C program to call the dll (SxSv.c):
Code:
#include "SxSv.h"
int loadDLL( )
{
int status = 0;
TestFunc _TestFunc;
HINSTANCE testLibrary = LoadLibrary("SxSv.dll");
if (testLibrary)
{
_TestFunc = (TestFunc)GetProcAddress(testLibrary, "SSXV");
if (_TestFunc)
{
status = _TestFunc(); // THIS IS THE LINE WITH THE ERROR
}
FreeLibrary(testLibrary);
}
return status;
}
The wrapper's header file (SxSv.h):
Code:
#ifndef DLLHANDLER_C_
#define DLLHANDLER_C_
#include <windows.h>
#include <winbase.h>
#include <windef.h>
#include <stdio.h>
typedef int (*TestFunc)(int);
int loadDLL( void );
#endif
The exported function SSXV() takes no arguments, so why does the line status = _TestFunc(); report "too few arguments" when I compile the C program to call the dll?
Thanks.