|Download Help (Windows Only)|
You can use the NI-DAQmx .NET platform-specific assembly for the 64-bit (x64) platform to create 64-bit NI-DAQmx applications. This assembly, NationalInstruments.DAQmx.dll , is located in the Program Files\National Instruments\<Product Name>\DotNET\Assemblies (64-bit)\Current directory.
The assembly name for the 64-bit platform-specific assembly is the same as the assembly name for the 32-bit platform-specific assembly, NationalInstruments.DAQmx.dll, and the location for the 32-bit (x86) platform-specific assembly is located in the Program Files\National Instruments\ProductName\DotNET\Assemblies\Current directory.
|Note Reading and writing with the NI-DAQmx .NET class library uses the same entry points for both the x86 and the x64 versions of the platform-specific assemblies because of the array size limitation in the .NET Framework.|
Not all NI DAQ hardware supported by NI-DAQmx is supported in 64-bit user mode. Refer to the NI-DAQ Readme for more information, installed at.
The .NET Framework, versions 2.0 and later, includes different versions of the Common Language Runtime (CLR) for different processor architectures. Processor architectures supported by the CLR include x86, Itanium, and x64. x86 is a 32-bit architecture, while Itanium and x64 are 64-bit architectures.
Different variants of Windows operating systems exist to support different architectures. For example, Windows Vista 32-bit supports the x86 architecture and Windows Vista 64-bit supports the x64 architecture. Additionally, the x64 architecture supports the x86 instruction set, allowing 64-bit versions of Windows to include the WOW64 emulator. Consequently, both the 32-bit x86 version of the CLR and the 64-bit x64 version of the CLR can run on 64-bit versions of Windows. Applications that run under the x86 version of the CLR are 32-bit applications. Applications that run under the 64-bit version of the CLR are 64-bit applications. 64-bit applications cannot load 32-bit assemblies, and 32-bit applications cannot load 64-bit assemblies.
Every assembly built for the.NET Framework 2.0 and later specifies a target platform. The target platform indicates whether the assembly can be run with the 32-bit, x86 version of the CLR or the 64-bit, x64 version of the CLR. Target platforms supported by NI assemblies include x86, x64, and AnyCPU.
The x86 target platform indicates that the assembly is compiled for and can be run only under the 32-bit, x86 version of the CLR. The x64 target platform indicates that the assembly is compiled for and can be run only under the 64-bit, x64 version of the CLR. The AnyCPU target platform indicates that the assembly is compiled in a manner that allows it to be run under any version of the CLR. Assemblies with target platform set to x86 or x64 are referred to as platform-specific assemblies. Assemblies with target platform set to AnyCPU are referred to as platform-agnostic assemblies.
The following table summarizes the preceding information:
|Assembly Target Platform||Compilers||Operating Systems||CLR Versions||Assembly Type|
|x86||Visual C#, Visual Basic .NET||32-bit, 64-bit||x86||Platform-Specific|
|x64||Visual C#, Visual Basic .NET||64-bit||x64||Platform-Specific|
|AnyCPU||Visual C#, Visual Basic .NET||32-bit, 64-bit||x86, x64||Platform-Agnostic|
The following example demonstrates how platform-specific and platform-agnostic assemblies are used in platform-specific and platform-agnostic applications.
If you have the following three assemblies:
|Assembly Name||Target Platform|
|Assembly1_AnyCPU.dll||Any CPU (AnyCPU in Visual Basic)|
And the following three applications:
|Application Name||Target Platform|
|Application1_AnyCPU.exe||Any CPU (AnyCPU in Visual Basic)|
When you run a platform-agnostic or x64 platform-specific application on a 64-bit operating system and your application references a platform-specific assembly, the CLR automatically uses the x64 assembly, even if the project used to build the application references an x86 version of a platform-specific assembly.
|Note If the CLR attempts to load the 64-bit assembly and cannot find it, the CLR will attempt to load the x86 assembly instead, causing the CLR to generate a BadImageFormatException.|
Some NI class libraries include platform-specific assemblies and some include platform-agnostic assemblies. Class libraries, such as the NI-DAQmx .NET library, that include platform-specific assemblies include two versions of the assembly, one that supports the x86 platform and one that supports the x64 platform. Both versions of the assembly have the same name, but they are installed to different locations:
When you compile a project with target platform set to x64 with a reference to an x86 assembly, the compiler generates a warning. Change the project target platform to x86 or AnyCPU to resolve this warning.
|Tip If your project references any class libraries that do not have 64-bit support, such as the DataSocket .NET class library or NI-DAQmx .NET class libraries prior to version 8.9.5, then the target platform for the project must be x86.|
The .NET Framework 4.0 CLR (both 32-bit and 64-bit versions) and earlier versions limit the maximum size of a single object, including arrays, to 2 gigabytes (GB). As a result of this 2 GB maximum, the number of items that an array can contain depends on the type and what the type contains.
As a consequence of this array size limitation, NI .NET arrays cannot return the same number of items as the corresponding C API can in an unmanaged layer, as unmanaged 64-bit applications can reference blocks of memory larger than 2 GB.
These restrictions typically affect input and output operations. For example, the NI-DAQmx .NET class library restricts the number of samples you can obtain in each read operation.
In .NET Framework 4.5, you can use the <gcAllowVeryLargeObjects> element to enable arrays that are greater than 2 gigabytes (GB) in total size. NI .NET class libraries do not support arrays greater than 2 GB in size; therefore, using arrays greater than 2 GB in NI .NET class libraries could result in errors or unexpected behavior.
To facilitate use in Visual Studio Setup projects, all NI .NET class libraries that support 64-bit include both 32-bit and 64-bit deployment merge modules. This is true regardless of whether the class library includes platform-specific or platform-agnostic assemblies.