I have a Dll that was created with VC++. I'm very sure the Dll works, because when I import it into a test program written in VC++, it works and gives the correct data.
But when I try to use it in a VB.Net test program, it throws a System.EntryPointNotFoundException
All of the Dll functions uses stdcall.
Here's the source code of the VB.NET test program:
Public Class Form1
Public Declare Function func Lib "dll.dll" () As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = func().ToString()
End Sub
End Class
Here is the source code of the DLL
#include <SDKDDKVer.h>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
__declspec(dllexport)int _stdcall func();
BOOL APIENTRY DllMain(HMODULE hModule,DWORD l_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
int _stdcall func()
{
return 123;
}
Can anyone help?