title: Matlab S-Function (Compiled with VS 2013) - Error while obtaining sizes (...) could not find procedure
body: <p>When I try to run my simulation I get error from S-function:</p>
  
  <blockquote>
    <p>Error while obtaining sizes from MEX S-function 'sfunction' in 'test/S-Function'.
    Caused by:
    Invalid MEX-file ($PATH)\sfunction.mexw64': Could not find procedure.</p>
  </blockquote>
  
  <p>My debug output:</p>
  
  <pre><code>'MATLAB.exe' (Win32): Loaded '($PATH)\sfunction.mexw64'. Symbols loaded.
   First-chance exception at 0x0000000077057468 (ntdll.dll) in MATLAB.exe: 0xC0000139: Entry Point Not Found.
  'MATLAB.exe' (Win32): Unloaded '($PATH)\sfunction.mexw64'
  'MATLAB.exe' (Win32): Loaded '($PATH)\sfunction.mexw64'. Symbols loaded.
  First-chance exception at 0x0000000077057468 (ntdll.dll) in MATLAB.exe: 0xC0000139: Entry Point Not Found.
  'MATLAB.exe' (Win32): Unloaded '($PATH)\sfunction.mexw64'
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: MathWorks::System::SimpleException at memory location 0x000000000401F2C8.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: MathWorks::System::SimpleException at memory location 0x000000000401F2C8.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: MathWorks::System::SimpleException at memory location 0x000000000401F2C8.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x0000000004027440.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: AmbiguousNameException at memory location 0x0000000004017190.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: AmbiguousPropertyException at memory location 0x00000000040171B0.
  The thread 0x1a94 has exited with code 0 (0x0).
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  &gt; throw_segv_longjmp_seh_filter()
  throw_segv_longjmp_seh_filter(): C++ exception
  &lt; throw_segv_longjmp_seh_filter() =EXCEPTION_CONTINUE_SEARCH
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  &gt; throw_segv_longjmp_seh_filter()
  throw_segv_longjmp_seh_filter(): C++ exception
  &lt; throw_segv_longjmp_seh_filter() =EXCEPTION_CONTINUE_SEARCH
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x000000000401B648.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: SLSVErrorException at memory location 0x0000000004014048.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: AmbiguousNameException at memory location 0x00000000040235D0.
  First-chance exception at 0x000007FEFCD9ADCD in MATLAB.exe: Microsoft C++ exception: AmbiguousPropertyException at memory location 0x00000000040235F0.
  The thread 0x7e0 has exited with code 0 (0x0).
  </code></pre>
  
  <p>I would really appreciate your input, I've been searching for solution for days</p>