I have programmed this example for the last 6 years with various versions of Mathematica and .NET. This year I have moved to Version 10.0.2 and it doesn't work. I am using Visual Studio 12 for C#. My C# code is unremarkable:

string[] mlArgs = { "-linkmode", "launch", "-linkname", @"C:\Program Files\Wolfram Research\Mathematica\10.0\SystemFiles\Kernel\Binaries\Windows-x86-64\MathKernel.exe" };
            IKernelLink ml = null;
                ml = MathLinkFactory.CreateKernelLink(mlArgs);
                string result = ml.EvaluateToOutputForm("2+2", 0);
                txtFirst.Text = result;
            catch (Exception ee)
                if (ml != null)

The ERROR I receive is:

"The type initializer for 'Wolfram.NETLink.Internal.NativeLink' threw an exception."

along with:

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

Any help much appreciated!

Thank you,


  • 1
    $\begingroup$ On my system the file ml32i4.dll is found in the following directory: \Mathematica\10.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\SystemAdditions -- can you confirm that this file is present in your installation? $\endgroup$
    – Mr.Wizard
    Feb 8, 2015 at 10:41
  • $\begingroup$ It should also be somewhere in %PATH% if it's to be found after linking. Is it? (N.B. this is a solution to your problem as well as a question.) $\endgroup$ Feb 8, 2015 at 14:01

1 Answer 1


In v10, the Windows version no longer installs the MathLink libraries to \Windows\System32. The recommended way of dealing with this is to 'redist' a copy of ml32i4.dll with the app.

  • $\begingroup$ Where can one download the redistributable package? $\endgroup$ Feb 9, 2015 at 15:07
  • 1
    $\begingroup$ $InstallationDirectory\SystemFiles\Links[MathLink/WSTP]\DeveloperKit[Windows/Windows-x86-64]\SystemAdditions $\endgroup$
    – ihojnicki
    Feb 9, 2015 at 17:45
  • $\begingroup$ I see. Well, those are just the DLLs themselves; I was expecting that there would be a proper installer available for download that would use the "side-by-side assembly" mechanism. Otherwise, shared-memory links will not work, because this requires both ends of the link to have loaded the same library from the same location. This is the main reason one would use a DLL in the first place rather than statically linking. Or does MathLink 4 do something else as well to address that situation? $\endgroup$ Feb 9, 2015 at 22:58
  • $\begingroup$ Even i3 didn't have this requirement. $\endgroup$
    – ihojnicki
    Feb 10, 2015 at 2:19
  • 1
    $\begingroup$ Thank you so much for your help. This has fixed the problem. I put the missing dll (copied from \Mathematica\10.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\SystemAdditio​ns, note 64 bit versions also available) into the bin/debug or bin/release directory in my .NET project. Sorry for delay in responding - I was away. Best wishes, Kieran $\endgroup$
    – user25245
    Feb 16, 2015 at 8:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.