title: how to call a C++ dll from C# windows application project
body: <p>I have created a dll in C++ using a Class Library project in Visual Studio. I need to call a method in the dll from a C# application.  </p>
  
  <p>I got to know there are 2 approches. One is to add the dll project reference to C# project or use DllExport to export method. However when I tried in both ways it always gives the following error when the dll method is called in runtime.</p>
  
  <p><strong>An unhandled exception of type 'System.BadImageFormatException' occurred in TestClient.exe
  Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)</strong></p>
  
  <p>Can i know how to avoid this problem ?</p>
  
  <p>Thanks in advance!</p>