Can 32 bit apps work on 64 bit computers?

N

neuromancer

I wrote a C# application and compiled it with Visual Studio Express
2010 on my 32 bit PC. But my brother has bought a 64 bit PC, and he
wants to run the application.
I assumed that a 32 app would not work on his PC, and therefore I
told him to download a compiler on to his PC, and then to compile the
source-code to my app.
Was this the right reasoning?
Anyway, he then went ahead and tried to download and install Visual
Studio Express 2010. There was no option saying '64 bit version' so
he tried to install whatever Microsoft supplied. It failed to
install. Perhaps that is also a 64 vs 32 bit issue.
Any help is appreciated:
FN13
 
A

Arne Vajhøj

I wrote a C# application and compiled it with Visual Studio Express
2010 on my 32 bit PC. But my brother has bought a 64 bit PC, and he
wants to run the application.
I assumed that a 32 app would not work on his PC, and therefore I
told him to download a compiler on to his PC, and then to compile the
source-code to my app.
Was this the right reasoning?

No.

32 bit apps should run on 64 bit Windows.

Arne
 
R

RayLopez99

But, even if you created the project in VS2010 and never changed the
target platform configuration (i.e. it's still "x86"), your 32-bit .NET
application will run fine on a 64-bit system, no changes necessary.

Rigggggght Pete. "In theory" as they say.

In practice you should know that software targets hardware. What if
some line of code demands the machine be 32 bit? Fail on that line of
code.

RL
 
J

Jeff Gaines

In practice you should know that software targets hardware. What if
some line of code demands the machine be 32 bit? Fail on that line of
code.

I'm sure that Peter will respond if he feels it appropriate but in the
meantime...

I think it is more accurate to say that the operating system, Windows in
this case, addresses the hardware. In fact Windows goes to a lot of
trouble to stop programmers directly addressing the hardware.
VS allows you to write programs that interact with the OS, the OS will
then deal with the hardware (through the API and drivers). That's why both
32 bit and 64 bit programs can happily run on 64 bit versions of Windows.
There are some drivers, the MSFT Access drivers spring to mind, that are
32 bit only so if you use those you do need to specifically target a 32
bit platform.

Also you suggested in another post in the thread that the OP looks for a
64 bit version of VS, he/she will be looking a long time as there isn't one.
 
A

Arne Vajhøj

Rigggggght Pete. "In theory" as they say.

In practice you should know that software targets hardware. What if
some line of code demands the machine be 32 bit? Fail on that line of
code.

No. It will work fine. x86-64 CPU's in 32 bit mode are compatible with
x86 CPU's.

Arne
 
A

Arne Vajhøj

I'm sure that Peter will respond if he feels it appropriate but in the
meantime...

I think it is more accurate to say that the operating system, Windows in
this case, addresses the hardware. In fact Windows goes to a lot of
trouble to stop programmers directly addressing the hardware.
VS allows you to write programs that interact with the OS, the OS will
then deal with the hardware (through the API and drivers). That's why
both 32 bit and 64 bit programs can happily run on 64 bit versions of
Windows.
There are some drivers, the MSFT Access drivers spring to mind, that are
32 bit only so if you use those you do need to specifically target a 32
bit platform.

Also you suggested in another post in the thread that the OP looks for a
64 bit version of VS, he/she will be looking a long time as there isn't
one.

There are multiple aspects of this.

For .NET code then the point is that MSIL is neither 32 or 64
bit. It get JIT compiled to 32 or 64 bit native code at runtime
depending on the CLR it is being run with.

For target any CPU. For targets x86 and x64 you are telling the
CLR that there are something in the app (like use of native code)
that requires either 32 or 64 bit. So it checks.

An x86-64 CPU has a 32 bit mode, so it can run a 32 bit Windows
just fine.

The same 32 bit mode of the 64 bit CPU combined with a 32 bit sub system
in 64 bit Windows ensures that 32 bits apps can run on that platform.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top