Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EntryPointNotFoundException loading a C DLL in VB.net

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

like image 953
Dan F Avatar asked Mar 16 '26 19:03

Dan F


1 Answers

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:

enter image description here

like image 80
David Heffernan Avatar answered Mar 19 '26 10:03

David Heffernan