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:
try
{
string[] mlArgs = { "-linkmode", "launch", "-linkname", "C:/Program Files/Wolfram Research/Wolfram Engine/13.1/wolfram.exe" };
kernelLink = MathLinkFactory.CreateKernelLink(mlArgs);
kernelLink.WaitAndDiscardAnswer();
}
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:
- Copied
Wolfram.NETLink.DLL
andml32i4.dll
to the same folder as the application executable. This has no effect. - Set a reference path to the same folder. This has no effect.
Questions
- Are there additional dependencies required by
Wolfram.NETLink.DLL
andml32i4.dll
?
No
- NuGet added a reference to the project for the
Wolfram.NETLink
assembly. Do I need to manually add a reference to the project forml32i4.dll
?
No
Solution
- Add the output directory folder specification to the machine
%PATH%
environmental variable.