I am having trouble calling a C++ function from dll in VB.net project. I have tried with the simple examples shown below
For C++ dll
#include <cmath>
extern "C" __declspec(dllexport) double SquareRoot(double value)
{
return pow(value, 0.5);
}
I build the dll and copy it to the VB.net folder
For VB.net project
Module Module1
<Runtime.InteropServices.DllImport("DLL_Test.dll")> _
Private Function SquareRoot(ByVal value As Double) As Double
End Function
Sub Main()
MsgBox(SquareRoot(2))
End Sub
End Module
I keep getting Additional information: Unable to find an entry point named 'SquareRoot' in DLL 'DLL_Test.dll'
. When I run dumpbin.exe
on DLL_Test.dll
I get the following
File Type: DLL
Summary
1000 .data
1000 .idata
2000 .rdata
1000 .reloc
1000 .rsrc
4000 .text
10000 .textbss
I am not sure what I am missing, any ideas? Thanks in advance.