Archived Forum Post

Index of archived forum posts

Question:

Does My .NET Application Need Two Separate Builds (32-bit and 64-bit)?

Dec 03 '12 at 14:36

I noticed that there are separate downloads for 32-bit and 64-bit .NET assemblies. Does this mean I would need to build my application for 2 versions? One for 32-bit and one for 64-bit?


Answer

The Chilkat components and libs are internally written in C++ and compile to native code. It is the same code base that is used across all operating systems, programming languages, frameworks, etc. Supporting each separate programming language involves only a thin wrapping around the inner core. Therefore, the Chilkat .NET assembly is a mixed-mode assembly, with a full-managed API but with an unmanaged inner core. (There is no COM involved in the Chilkat .NET assembly.)

A .NET application that uses Chilkat must load the assembly (DLL) that matches the address space of the application process. If it's a 32-bit process, it must load the 32-bit assembly, if it's a 64-bit process, it must load the 64-bit assembly.

There are several strategies for handling this, and I'll list each.

1) If an application is targeted for "Any CPU" in Visual Studio, then it will run in an address space that is the same as the platform (32-bit on 32-bit computers, and 64-bit on 64-bit computers). In this case, you'll need to make sure to distribute the matching Chilkat assembly based on the target computer. Only one build of your application is required.

2) You may specifically target an application for 32-bit. In this case, the application always runs as a 32-bit process regardless of the computer, and you'll always use the 32-bit Chilkat assembly.

3) Pre-install the Chilkat assemblies in the GAC's (Global Assembly Cache). Install the 32-bit assembly in the 32-bit GAC, and install the 64-bit assembly in the 64-bit GAC. This way, any program running on that particular computer will automatically use the correct Chilkat assembly (assuming the assembly is no longer distributed w/ the app in the app's bin directory).