I have added Wolfram.NETLink to a C# .NET Framework 4.6.1 application via NuGet. NuGet installs this to the C:\Users\[user]\.nuget\packages\wolfram.netlink\1.7.1 folder.

I have a C# application and am trying to execute the following code:

       string[] mlArgs = { "-linkmode", "launch", "-linkname", "C:/Program Files/Wolfram Research/Wolfram Engine/13.1/wolfram.exe" };
       kernelLink = MathLinkFactory.CreateKernelLink(mlArgs);
   catch(MathLinkException mlEx)
       engineStatus = mlEx.Message;

The call to kernelLink = MathLinkFactory.CreaterKernelLink(mlArgs); throws an exception:

"Unable to load DLL 'ml32i4.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}   System.Exception {System.DllNotFoundException}

What I have tried so far:

  1. Copied Wolfram.NETLink.DLL and ml32i4.dll to the same folder as the application executable. This has no effect.
  2. Set a reference path to the same folder. This has no effect.


  1. Are there additional dependencies required by Wolfram.NETLink.DLL and ml32i4.dll?


  1. NuGet added a reference to the project for the Wolfram.NETLink assembly. Do I need to manually add a reference to the project for ml32i4.dll?



  1. Add the output directory folder specification to the machine %PATH% environmental variable.
  • $\begingroup$ The 32 in ml32i4.dll means 32-bit. Are you targeting your app for 64 bit? MS docs page $\endgroup$
    – ihojnicki
    Oct 27, 2022 at 17:04
  • $\begingroup$ 32-bit in this case. $\endgroup$ Oct 27, 2022 at 17:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.