NMath User's Guide

TOC | Previous | Next | Index

1.7 Building and Deploying NMath Applications (.NET, C#, CSharp, VB, Visual Basic, F#)

To use NMath types in your application, add a reference to NMath.dll. It is not necessary to add references to the kernel assemblies—the appropriate kernel assembly for your platform is loaded at runtime, and the appropriate native DLL is linked to the kernel. The search order is the same as for the common language runtime: first the GAC is searched, then the directory containing the currently executing assembly, and so on. (See Section 1.6 for more information.)

We recommend that you build your application using the Any CPU build configuration, so you can deploy to either 32-bit or 64-bit environments. (If you are building for .NET 4.5 or higher, also ensure that the Prefer 32-bit flag is unchecked, under Build | Platform target in your project properties.)

To deploy your application, either

Install the NMath .NET assemblies in the GAC (NMath.dll, and x86/NMathKernelx86.dll or x64/NMathKernelx64.dll, or both)—the appropriate native DLLs will also be placed in the GAC, since they are linked resources to the kernel assemblies; or

Place the main .NET assembly (NMath.dll) in the same directory as your application. Use the NativeLocation property, or the equivalent environment variable or app config setting, to specify the location of the native assemblies (Section 1.6). The specified location should contain /x86 and /x64 subdirectories. The appropriate architecture-specific natives are loaded at runtime.

If your application fails to locate the kernel or native assemblies at runtime, enable configuration logging (Section 1.6), which will provide information on the search path.

License Key

A valid license key must accompany your deployed NMath code. The key can be specified using an environment variable, app config setting, or compiled in your code for greatest security. (See Section 1.6 for more information.)

C++ Runtime

NMath has a dependency on the Microsoft Visual C++ 2013 runtime. The NMath installer places the C++ runtime on your development machine, if necessary. However, when you deploy your application, you may need to add it to your installer.

There are two ways to do this:

Add the Microsoft Visual C++ 2013 merge module to your installer. It can be found here:

x86: C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC120_CRT_x86.msm

x64: C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC120_CRT_x64.msm

or on the web.

Use the Microsoft Visual C++ 2013 redistributable:

http://www.microsoft.com/en-us/download/details.aspx?id=40784


Top

Top