64-bit functions in a 32-bit application?

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

At this point, I cannot convert the entire application to 64-bit due to dependencies on third-party functions.

However, I would like to have access to the xmm9-xmm15 registers in my SSE optimizations, as well as use the additional registers that the 64-bit processor provides as a whole when running my application.

Is it possible to achieve this with some compiler flag?

+6
source share
2 answers

It seems to me that the best way would be to split your program into more than one executable . An exe compiled as 64-bit can link to another 32-bit exe, it uses the 32-bit third party DLL you need. You will have some overhead in connection, and you will have to start / stop the dependent process, but you will have a clear program architecture.

If you are developing your own C ++ application, you can implement a second EXE, for example, as a COM-out-of-process object (LocalServer or even LocalService). You can consider a way to implement a COM server in C # (see here ). Sometimes this method can simplify the implementation, and you can take advantage of both .NET and your own programming.

+9
source

Yes, you can. See this example for what.

As Christopher noted, this technique will not always work, but for this direct purpose, to go to several lines of the assembly manually and use more registers, then put the result somewhere, and then return to 32 bit mode, it should work well.

+3
source

Source: https://habr.com/ru/post/886772/


All Articles