title: System.EntryPointNotFoundException when importing functions from a dll
body: <p>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.</p>
  
  <p>But when I try to use it in a VB.Net test program, it throws a System.EntryPointNotFoundException</p>
  
  <p>All of the Dll functions uses stdcall.</p>
  
  <p>Here's the source code of the VB.NET test program:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Here is the source code of the DLL</p>
  
  <pre><code>#include &lt;SDKDDKVer.h&gt;
  #define WIN32_LEAN_AND_MEAN
  #include &lt;Windows.h&gt;
  __declspec(dllexport)int _stdcall func();
  
  BOOL APIENTRY DllMain(HMODULE hModule,DWORD l_reason_for_call, LPVOID lpReserved)
  {
      return TRUE;
  }
  int _stdcall func()
  {
      return 123;
  }
  </code></pre>
  
  <p>Can anyone help?</p>