title: C# P\Invoke DLL no entry point into C++?
body: <p>I have a C++ Dll "TheFoo.dll" with a method "Foo()"</p>
  
  <p>I have access to other C++ code that uses this method by simply calling:</p>
  
  <pre><code>Foo();
  </code></pre>
  
  <p>I believe the Method does have the:</p>
  
  <pre><code> __declspec( dllexport )
  </code></pre>
  
  <p>So, with the reading I've done about P/Invoke, i thought i should be able to simply call the same method from my C# code:</p>
  
  <pre><code>namespace PInvokeExample1
  {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
  
          }
  
  
          [DllImport(@"C:\MyFolder\TheFoo.dll")]
          public static extern
              void Foo();
  
          private void button1_Click(object sender, RoutedEventArgs e)
          {
              Foo();
  
          }
  
  
  
      }
  }
  </code></pre>
  
  <p>When i run it, i get an error:</p>
  
  <pre><code>Unable to find an entry point named 'Foo' in DLL 'C:\MyFolder\TheFoo.dll'.
  </code></pre>
  
  <p>Any ideas why it is not found?</p>