|Download Help (Windows Only)|
You can use Measurement Studio .NET assemblies in 64-bit applications to take advantage of the increased processing power and memory performance that are available to 64-bit applications. For more information on creating, compiling, and running 64-bit applications, refer to 64-bit Applications.
Measurement Studio includes 64-bit support for the following class libraries:
|Note: 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 Start»All Programs»National Instruments»NI-DAQ»NI-DAQ Readme.|
Measurement Studio does not include 64-bit support for the following:
The following information describes how to use Measurement Studio .NET assemblies in 64-bit applications:
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.
|Note: Measurement Studio does not support the Itanium processor architecture.|
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 Measurement Studio 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)|
Running these applications on a 32-bit operating system has the following results:
In comparison, running these executables on a 64-bit operating system has the following results:
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 Measurement Studio class libraries include platform-specific assemblies and some include platform-agnostic assemblies, depending on the language used to implement the class library. Class libraries 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:
To determine whether a Measurement Studio assembly includes platform-specific or platform-agnostic assemblies, refer to the relevant class library-specific 64-bit topic in the Using the Measurement Studio .NET Class Libraries section of the Measurement Studio Help. For example, the appropriate 64-bit Help topic for the NI-DAQmx library is named Working with 64-bit .NET Support for NI-DAQmx and is located in the Using the Measurement Studio NI-DAQmx .NET Library section of the Help.
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 CLR (both 32-bit and 64-bit versions) limits the maximum size of a single object, including arrays, to 2 GB (Int32.MaxValue). As a result of this 2GB 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, Measurement Studio .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.
To facilitate use in Visual Studio Setup projects, all Measurement Studio 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. Refer to Deploying Windows Applications for more information on using 64-bit merge modules.