.NET Forum / .NET Framework / New Users / November 2006
x86 vs x64
|
|
Thread rating:  |
param@community.nospam - 03 Nov 2006 18:38 GMT Hi all,
We are considering migrating some of our production web and application servers to 64-bit platform. My question is do I need to re-compile my code on a x64 machine running a x64 version of Windows and x64 version of .net? Or will the same code run on the new x64 environment without recompilation needed.
TIA!
Cowboy (Gregory A. Beamer) - 03 Nov 2006 20:25 GMT You can set to compile for x64 on a 32-bit machine and end up with a "binary" (.NEt si actually byte code) that runs only on 64-bit machines (optimized for 64-bit). If you leave at default (any platform), it will not be as optimized, but will run on both x86 and x64.
 Signature Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA http://gregorybeamer.spaces.live.com
************************************************* Think outside of the box! *************************************************
> Hi all, > [quoted text clipped - 5 lines] > > TIA! Michael Nemtsev - 03 Nov 2006 21:57 GMT Hello Cowboy (Gregory A. Beamer),
C> If you leave at default (any platform), it will not be as optimized,
Could you point where u get this?
AFAIK, the /platform compiler option only set the desired PE header - PE32 or PE32+ and emit desired architecture into header. There is nothing relating to the compilation, that btw take place only when u start app, not compile it
--- WBR, Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche
param@community.nospam - 05 Nov 2006 16:05 GMT So that should be for my dlls. What about the .aspx pages? Doesnt the framework compile those? Any special setting?
> You can set to compile for x64 on a 32-bit machine and end up with a > "binary" (.NEt si actually byte code) that runs only on 64-bit machines [quoted text clipped - 10 lines] >> >> TIA! Kevin Yu [MSFT] - 06 Nov 2006 06:13 GMT Hi,
You don't need to care about the .aspx file. The .aspx pages are rendered at runtime. The .NET framework will do that according to the platform.
In this case, what you need to care about is the file directory and registry writing and COM interoping in your app. You can just select Any CPU from configuration manager to make your .NET app platform independent.
If anything is unclear, please feel free to let me know.
Kevin Yu Microsoft Online Community Support
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
(This posting is provided "AS IS", with no warranties, and confers no rights.)
param@community.nospam - 06 Nov 2006 15:00 GMT Why do I need to be careful about registry writing and file writing? Some of my current code that runs on x86 does read from the registry and does read/write files to disk.
TIA
> Hi, > [quoted text clipped - 29 lines] > (This posting is provided "AS IS", with no warranties, and confers no > rights.) Kevin Yu [MSFT] - 07 Nov 2006 01:36 GMT Hi,
Because if a 32bit app is running on a 64bit windows, it is using Windows on Windows 64(WOW64). Some of the registrys and System32 directory will be mapped to other places. For example, System32 will be mapped to Syswow64. Program Files folder is mapped to Program Files (x86). In this case, you have to be careful if you need to read from these registry keys and folders. You will find more from the following links:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog64/w inprog64/registry_redirector.asp http://msdn.microsoft.com/msdnmag/issues/06/05/x64/default.aspx http://msdn.microsoft.com/isv/technology/64bitwindows/x64faq/developmentfaq/ default.aspx
Kevin Yu Microsoft Online Community Support ==================================================
(This posting is provided "AS IS", with no warranties, and confers no rights.)
param@community.nospam - 07 Nov 2006 17:30 GMT My apps write to none of the folders you have outlined below. They write to specified folders like d:\myapp etc.
They also read/write to the following registry keys:-
EventLog - using the .net EventLog classes HKLM\MyCompany\Software - custom key
> Hi, > [quoted text clipped - 17 lines] > (This posting is provided "AS IS", with no warranties, and confers no > rights.) Chris Mullins - 08 Nov 2006 00:03 GMT Be warned then, that Vista will likley consider your App to be broken, and it won't run.
You need to be writing data to specific locations on the file system, not just "D:\myapp\".
-- Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.covesant.net/blogs/cmullins
> My apps write to none of the folders you have outlined below. They write > to specified folders like d:\myapp etc. [quoted text clipped - 26 lines] >> (This posting is provided "AS IS", with no warranties, and confers no >> rights.) Kevin Yu [MSFT] - 08 Nov 2006 02:32 GMT Hi,
There is no problem writing to that specified folder like d:\myapp and registry like (I think it has to be) HKLM\Software \MyCompany. When your .net app is running on a 64bit windows, it will be working as a 64 bit process, so there will be no problem.
What I mean is that if your app is reading a registry key that a 32bit app has left, we have to take care of the redirection. In WOW64 modde, the HKLM\Software will be redirected to HKLM\Software\WOW6432node. Under WOW6432node all the nodes under HKLM\Software will be reflected. A 32bit app running on WOW64 which is writing to HKLM\Software will actually be writing to HKLM\Software\WOW6432node.
Since your app is reading/writing to its own keys in completely 64bit mode, you don't need to worry about it.
Kevin Yu Microsoft Online Community Support ==================================================
(This posting is provided "AS IS", with no warranties, and confers no rights.)
Phil Wilson - 04 Nov 2006 02:07 GMT The issue to watch out for with "some of our production" is a mixture of related 32-bit apps and 64-bit apps both running on the same system. If you have (say) 64-bit apps that write registry entries for 32-bit apps to see then they're potentially going to fail when the 64-bit app writes to the registry and the 32-bit app reads from the 32-bit view of the registry. There's potential for COM misconnects too, if you're using COM. So if you do convert some apps to run 64-bit and not others, this is something to watch out for.
 Signature Phil Wilson [Microsoft MVP Windows Installer]
> Hi all, > [quoted text clipped - 5 lines] > > TIA!
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|