0

I have a dotnet project in which i have used MWCharArray matlab function but it continuous giving me error System.TypeInitializationException: 'The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception.'

DllNotFoundException: Unable to load DLL 'mclmcrrt9_0_1.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I have installed matlab runtime compiler and i have the mclmcrrt9_0_1.dll in my

C:\Program Files\MATLAB\MATLAB Runtime\v901\runtime\win64 folder

I have also set the environment path variable C:\Program Files\MATLAB\MATLAB Runtime\v901\runtime\win64

then also this error is not going. Is there any thing i'm missing here??

1 Answers1

0

You have to add a config file to reference the dll, at the moment you application does not know where your dll is stored.

Below you will find a config file that i used to load external dll from siemens, you have to be careful with you path, if your path contains empty characters you have to write %20 instead of the empty character:

For example instead of C:\\My Folder you muss write C:\\My%20Folder

<configuration>
     <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
              <assemblyIdentity name="Siemens.Engineering" culture="neutral" publicKeyToken="d29ec89bac048f84"/>
              <codeBase version="15.1.0.0" href="file:///C:\Program%20Files\Siemens\Automation\Portal%20V15_1\PublicAPI\V15.1\Siemens.Engineering.dll"/>
              <codeBase version="16.0.0.0" href="file:///C:\Program%20Files\Siemens\Automation\Portal%20V16\PublicAPI\V16\Siemens.Engineering.dll"/>
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="Siemens.Engineering.Hmi" culture="neutral" publicKeyToken="37b6e3a80df0900f"/>
              <codeBase version="15.1.0.0" href="file:///C:\Program%20Files\Siemens\Automation\Portal%20V15_1\PublicAPI\V15.1\Siemens.Engineering.Hmi.dll"/>
              <codeBase version="16.0.0.0" href="file:///C:\Program%20Files\Siemens\Automation\Portal%20V16\PublicAPI\V16\Siemens.Engineering.Hmi.dll"/>
            </dependentAssembly>
          </assemblyBinding>
        </runtime>
</configuration>

To find the information about your dll you can show the following post:

How do I find the PublicKeyToken for a particular dll?

DonMiguelSanchez
  • 376
  • 3
  • 15