title: call matlab dll from c++: fail to initialize the library
body: <p>I try to use Demo code for detecting and matching SIFT features of David Lowe (lowe@cs.ubc.ca)</p>
  
  <p>in my code. So I compile the (.m)file in Matlab to generate DLL. Here is the command code in Matlab:</p>
  
  <pre><code>           mcc -B csharedlib:SiftMatch match.m sift.m -v
  </code></pre>
  
  <p>However, when I use the DLL in my C++ code( under VS2010), there is a problem:</p>
  
  <pre><code>              SiftMatchInitialize();
     This function returned false. I could not initialize the library.
  </code></pre>
  
  <p>and debug showed that:</p>
  
  <pre><code>    bool MW_CALL_CONV SiftMatchInitializeWithHandlers(
      mclOutputHandlerFcn error_handler,
      mclOutputHandlerFcn print_handler)
  {
      int bResult = 0;
    if (_mcr_inst != NULL)
      return true;
    if (!mclmcrInitialize())
      return false;
    if (!GetModuleFileName(GetModuleHandle("SiftMatch"), path_to_dll, _MAX_PATH))
      return false;
      {
          mclCtfStream ctfStream = 
              mclGetEmbeddedCtfStream(path_to_dll);
          if (ctfStream) {
              bResult = mclInitializeComponentInstanceEmbedded(   &amp;_mcr_inst,
                                                                  error_handler, 
                                                                  print_handler,
                                                                  ctfStream);
              mclDestroyStream(ctfStream);
          } else {
              bResult = 0;
          }
      }  
      if (!bResult)
      return false;
    return true;
  }
  </code></pre>
  
  <p>In this function ctfStream is NULL and bResult equals 0.
  So, what's the problem?</p>