Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

64 bit features in a 32 bit application?

I have a 32 bit application which I plan to run on 64bit Windows 7.

At this stage I cannot convert the entire application to 64 bit due to dependencies to thirdparty functionality.

However, I would like to have access to the xmm9-xmm15 registers in my SSE optimizations and also use the additional registers which 64 bit cpus provides in general while executing my application.

Is this possible to achieve with some compiler flag?

like image 827
ronag Avatar asked Apr 27 '11 07:04

ronag


People also ask

What is the difference between 32bit and 64bit applications?

A 32-bit system has a limit of 32 bit Windows 3.2 GB of RAM. The limit in its addressable space doesn't allow you to use the entire physical memory space of 4GB. A 64-bit system enables its users to store up to 17 Billion GB of RAM.

What happens if you use 64-bit on 32-bit?

You can't install 64-bit Windows on a 32-bit machine. It won't install, and if you hack it somehow to install, then it won't boot after the install has finished. It is possible that the previous OS installed on the machine was a 32-bit OS version and that is why you think the machine is 32-bit.

Can a 32-bit application use a 64-bit driver?

Because 32-bit device drivers cannot be used with the 64-bit operating system, these drivers must be recompiled as 64-bit objects. Moreover, the 64-bit drivers need to support both 32-bit applications and 64-bit applications.

What is the biggest advantage of 64bit vs 32bit?

Using 64 bit operating system with 64 bit processer, the system can perform an increased number of calculations per second. As a result, it increases the processing power and makes a computer run faster. This is limited in case of 32 bit operating system. You can multi-task, switch between various application etc.


2 Answers

It seems to me that the best way would be to divide your program in more than one executable. The EXE compiled as 64bit can communicate with another 32-bit EXE used the 32-bit thirdparty DLL which you need. You will have some overhead in the communication and will have to implement Starting/Stopping of depended process, but you will have clear program architecture.

If you develop native C++ application you can implement the second EXE for example as the COM++ out-of-process object (LocalServer or even LocalService). You can consider the way to implement the COM server in C# (see here). Sometimes that way could simplify the implementation and you can use the advantages of both .NET and native programming.

like image 115
Oleg Avatar answered Sep 21 '22 00:09

Oleg


Yes, you can. See this example for how.

As Christopher pointed out, this technique will not always work, but for this express purpose, to jump into a few lines of handcrafted assembly and make use of more registers, then put the result somewhere and then jump back to 32 bit mode, it should work out just fine.

like image 38
Prof. Falken Avatar answered Sep 22 '22 00:09

Prof. Falken