title: BadImageFormatException error when using C++ .dll function for C#?
body: <p>I am having trouble with using P/Invoke for C#. Here is the function (written in C++) that I am trying to call from the .dll:</p>
  
  <pre><code>string
  BeatTracker::getName() const
  {
      return "Tempo and Beat Tracker";
  }
  </code></pre>
  
  <p>And here is my code for trying to call this function:</p>
  
  <pre><code>[DllImport("qm-vamp-plugins.dll",EntryPoint="BeatTracker")]
  public static extern string getName();
  
  public QMTempo()
  {
     Console.WriteLine(getName());
  }
  </code></pre>
  
  <p>What seems to be wrong? I am getting a BadImageFormatException. And how can I know what is wrong in future references aside from the vague names the IDE is giving me? I am using Visual Studio 2008 by the way.</p>
  
  <p>Also I am using (but not sure if right) EntryPoint, to let it know that I am using the getName function from the BeatTracker class (because there are also getName functions for other classes, which are included in the single .dll file)</p>
  
  <p>Thanks!</p>