I have made a console application in C#
using MonoDevelop
compiled with Mono 3.2.1
configured as AnyCPU
in my Ubuntu
system.
When I take this application into some Windows 7 64bit
system and run it, in task manager list it shows a *32
postfix by its process name. Doesn't that mean it's run as a 32bit program? What should I do in order for this application to be run in 64bit
?
[UPDATE]
As a point was made in comments, let me clarify that in Windows 7
machine I'm using Microsoft's .Net library and not Mono's.
[UPDATE]
I searched the Internet a little bit and found out the following command which outputs stuff about an executable file in Linux:
:~$ file /bin/bash
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xe643cefb2c672ad94e955067c511537ddbab48da, stripped
So I tested it on a .exe
file compiled with AnyCPU
using Mono
and MonoDevelop
:
:~$ file /ConsoleTest/bin/Release/ConsoleTest.exe
/ConsoleTest/bin/Release/ConsoleTest.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows
Reading the Wikipedia page PE stands for 32bit programs while PE+ for 64bit ones.
Taking the tests further, I used MS Visual Studio to compile a simple console programs in three modes (AnyCPU
, x86
and x64
). Once compiled I took all three of them into my Ubuntu machine and tried the file
command on them. Here are the results:
:~$ file /ConsoleTest-AnyCPU.exe
/ConsoleTest-AnyCPU.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows
:~$ file /ConsoleTest-x86.exe
/ConsoleTest-x86.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows
:~$ file /ConsoleTest-x64.exe
/ConsoleTest-x64.exe: PE32+ executable (console) x86-64 Mono/.Net assembly, for MS Windows
As you can see only the x64
one is marked as PE+
! Then I tried running them in both Ubuntu and Windows.
In Ubuntu all three of them run! But unfortunately I've got no mean to say whether they are running in 32bit mode or 64bit!
In Windows while all three of them run (of course they do), the hated *32
postfix is shown in process name only in x86
compiled mode. The lack of *32
indicates that the other two modes of AnyCPU
and x64
are running in 64bit.
So my question still stands: What should I do to run an AnyCPU
compiled program using Mono
and MonoDevelop
in Ubuntu, as a 64bit process in Windows?