Turns out Delphi 2005 already supports 64-bit .NET. Danny Thorpe posted this to the Borland newsgroups:
For Microsoft C# 1.x, I think this is correct. The new PE header flags defined in .NET 2.0 to specify "bitness" (32 bit only, 64 bit only, or agnostic) are not supported by the MS C# 1.x compiler, for the simple reason that the .NET 2.0 bits were defined after the C# compiler was built and distributed. The beta C# 2.0 compiler for 32 bit .NET now includes support for the bitness flags and 64 bit execution.For Delphi, this is not correct. Delphi 2005 shipped after the .NET 2.0 bitness flags were added. We added several things to the Delphi 2005 compiler to support linking against the beta .NET 2.0 assemblies, including emitting the bitness flags (we default to agnostic) and the special extensions required for .NET 64 to consider a Delphi.NET app a candidate for running in 64 bit mode.
Another point that created a lot of confusion in conversations with Microsoft’s Josh Williams is managed vs unmanaged code. My understanding is that if a 32 bit .NET exe contains any unmanaged code, .NET 64 will not run it in 64 bit mode. Josh was really dumbfounded that 32 bit Delphi.NET apps were "floating up" to 64 bit execution until I convinced him that Delphi.NET produces 100% managed code apps, *and* the bitness flags, and the required 64 bit PE headers. (I think Josh is from the C++ side of the Microsoft house, where nothing is 100% managed)
Update: Hallvard Vassbotn notes in comments that Danny has an additional post indicating that some minor tweaks will be necessary to VCL for .NET for it to be 64-bit .NET compliant. So for the time being if you need to use this feature you’ll need to write WinForms or GUI-less apps.
{ 4 } Comments
C’mon Craig, how ’bout a link, or at least a news group
to start looking in.
Sure, here’s a link (click on my name).
From that thread:
"The plan is to make the minor adjustments necessary to the compiler and VCL.NET so that VCL.NET applications will run in 64 bit mode on 64 bit .NET and 32 bit mode in 32 bit .NET without modification. The same binary exe file can run as 64 bit and 32 bit code. The plan is to have this ready in the Delphi product release that supports .NET 2.0, since 64 bit is only implemented in .NET 2.0.
In Delphi 2005, VCL.NET apps don’t yet run in native 64 bit mode because of the way the compiler and VCL deal with OS handles. Delphi 2005 VCL.NET apps can realize address space improvements (4GB address space, up from 2GB) running in 32 bit .NET on 64 bit Windows.
We need to tweak the VCL and compiler slightly so that OS handles will change size to match the pointer size of the underlying platform. I don’t anticipate this to be a huge task, just one more on a very long list of things to get to.
-Danny "
Good point, Hallvard; I updated the post.
Post a Comment