title: C# call a C++ dll get EntryPointNotFoundException
body: <p>I was gaven a C++ dll file, a <code>lib</code> file and a header file. I need to call them from my C# application.</p>
  
  <p>header file looks like this:</p>
  
  <pre><code>class Clog ;
  
  class EXPORT_MACRO NB_DPSM
  {
  private:
      string sFileNameToAnalyze ;
  
      Clog *pLog ;
  
      void write2log(string text) ;
  
  public:
      NB_DPSM(void);
      ~NB_DPSM(void);
  
      void setFileNameToAnalyze(string FileNameToAnalyze) ;    
      int WriteGenbenchData(string&amp; message) ;
  };
  </code></pre>
  
  <p>In my C# code, I have those code:</p>
  
  <pre><code>internal ReturnStatus correctDataDLL(string rawDataFileName)
          {
              if (rawDataFileName == null || rawDataFileName.Length &lt;= 0)
              {
                  return ReturnStatus.Return_CannotFindFile;
              }
              else
              {
                  setFileNameToAnalyze(rawDataFileName);                          
              }
  
              string msg = "";
              int returnVal = WriteGenbenchData(ref msg);
  
  
              return ReturnStatus.Return_Success;
          }
  
  [DllImport("..\\..\\thirdParty\\cogs\\NB_DPSM.dll")]
  public static extern void setFileNameToAnalyze(string fileName);
  
  
  [DllImport("..\\..\\thirdParty\\cogs\\NB_DPSM.dll")]
  public static extern int WriteGenbenchData(ref string message);
  </code></pre>
  
  <p>I got <code>EntryPointNotFoundException</code> at the <code>setFileNameToAnalyze(rawDataFileName);</code> statement.</p>
  
  <p>Few questions:</p>
  
  <ol>
  <li><p>do I need to add that <code>lib</code> file into somewhere of my C# project? how?</p></li>
  <li><p>do I need to add the header file into my C# project? how? (no compile error for now)</p></li>
  <li><p>I would like to remove those <code>"..\\..\\thirdParty\\cogs\\"</code> hardcode path. how to this?</p></li>
  <li><p>how to get ride of that <code>EntryPointNotFoundException</code>?</p></li>
  </ol>
  
  <p>thanks,</p>