I've spent hours trying to get this simple test case working, and searching the internet for clues.
I have a VS 10 solution containing my VB.net project, and a VC++ DLL project.
In my DLL project i have:
json_main.cpp:
#include <Windows.h>
extern "C"
{
void testMethod(int* inVal )
{
*inVal += 5;
}
}
JSON.def:
LIBRARY JSON
DESCRIPTION 'Simple JSON encoder/decoder'
EXPORTS
testMethod
And my VB.net code:
<DllImport("C:/inetpub/wwwroot/facebook/AlumniFinder/Debug/JSON.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Sub testMethod(ByRef inVal As Integer)
End Sub
...
Dim var As Integer = 7
testMethod(var)
oLabel.Text = var.ToString
Yet when I try to run, I get the EntryPointNotFoundException.
Anyone know what I might be doing wrong here? I tried using dumpbin.exe on my DLL, but I don't get any function names out of it to determine the mangling scheme it is using
Use dumpbin /exports or Dependency Walker to check that you are exporting the function since it would seem that you are not.
My guess is that you didn't configure the build to pass the .def file to the linker. Do it like in this screenshot:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With