title: The mcc compiler "Depfun error" when building dll with .NET-dependencies and Enumerations That Encapsulate Data
body: <p>I ran into problems in MATLAB R2010b when creating a DLL that uses .NET-integration and enumerations with encapsulate data.</p>
  
  <p>Example:</p>
  
  <ol>
  <li>There is a .NET Assembly which is used in MATLAB, let's call it "MyAssembly" (MyAssembly.dll).</li>
  <li><p>There Matlab Enumerations Class "OpenMode"
  <pre><code>
  classdef OpenMode
      methods
          function obj = OpenMode(netType)
              obj.Net = netType;
          end
      end
      properties
          Net
      end
      enumeration
          ReadOnly  (MyAssembly.OpenMode.ReadOnly)
          ReadWrite (MyAssembly.OpenMode.ReadWrite)
      end
  end
  </pre></code>
  This class uses the .NET enumeration: "MyAssembly.OpenMode"
  In such a way to access the .NET-enumeration via Matlab-enumeration (In my case it is necessary for cast types):
  <pre><code>
  netElem = OpenMode.ReadOnly.Net;
  cls = class(netElem)
  cls = 
      MyAssembly.OpenMode
  </pre></code></p></li>
  <li><p>The Matlab-Function, that should be exported:
  <pre><code>
  function retVal = MyFunction(inputs)
      NET.addAssembly('MyAssembly.dll');
      flag = OpenMode.ReadOnly;
      netFlag = flag.Net;
      % Some code...
  end
  </pre></code></p></li>
  <li>Add .NET Assembly in Matlab (checking)
  <pre><code>
  NET.addAssembly('MyAssembly.dll')
  </pre></code></li>
  <li>Try to compile the Dll:
  <pre><code>
  mcc -B csharedlib:MyLib MyFunction
  </pre></code>
  ...and get the error:
  <pre><code>
  Depfun error: 'Undefined variable "MyAssembly" or class "MyAssembly.OpenMode.ReadOnly".' 
  ??? Error using ==> mcc
  Error executing mcc, return status = 1 (0x1).
  </pre></code></li>
  </ol>
  
  <p>The mcc compiler does not detect in code enumeration that "MyAssembly" exists, but here is a function will be compiled successfully:
  <pre><code>
      function retVal = MyFunction(inputs)
          netflag = MyAssembly.OpenMode.ReadOnly;
          % Some code...
      end
  </pre></code></p>
  
  <p>If you have faced similar problems in MATLAB and found a solution, please tell me what to do.</p>
  
  <p>Thanks!</p>
  
  <p>Regards,
  iroln</p>