Am using: Windows 10 64-bit and Visual Studio 2017 Pro.
I built a Visual-C++ DLL. config=active(Debug) Platform=Active(Win32) Platform_Target=Windows10
I also built a VB.NET windows forms GUI. config=active(Debug) Platform=Active(Any CPU) Target_CPU=Any CPU .NET 4.5.1
DLL has this empty function:
extern "C" BASICDLL_API void __stdcall test_empty_function(void)
{
}
VB.NET has this DLL declaration:
Imports System.Runtime.InteropServices
Module main_board_interface
Public Class NativeMethods
<DllImport("MyDll.dll")>
Public Shared Sub test_empty_function()
End Sub
VB.NET calls the empty DLL function when I click VB.NET button here....
Private Sub Button_test_main_board_Click(sender As Object, e As EventArgs) Handles Button_test_main_board.Click
main_board_interface.NativeMethods.test_empty_function() '<<< causes error
At this last line, I get this error:
System.BadImageFormatException:
'An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)'