How to make a 32-bit compiled program run correctly on a 64-bit system

Source: Internet
Author: User

Operating system from 32-bit into 64-bit, for users is a qualitative leap. As the CPU reads 1 time times the width of the data, both speed and accuracy bring a leap. At the same time, the CPU's read and write mode changes, for programmers, need to adapt to follow-up. Although, the 64-bit system supports 32-bit programs, but is conditional, because the system to the CPU operation has changed, some 32 bits on the operation, it can not be in the 64-bit operation. For example, the software through the call to the bottom, through the compilation of read and write data source program, on the 32-bit run freely, on the 64-bit problem, the execution error.
In terms of development tools, Java-based,. NET can support 64-bit platforms with great success. Because they do not invoke the underlying implementation code, they are based instead. NET call implementation. For Delphi, since it is closely related to the operating system, the data types associated with it, the operating system SDK and other changes will be very large, so from 32-bit to 64-bit migration will have some difficulties. As for assembly language, it will change a lot.
Recently, I encountered a problem: on the 32-bit compiled (c/s) three-tier database management system, because the client server operating system from 32-bit upgrade to 64-bit, and even the original server (program) can not run on a 64-bit server system. To this end, the author through the improvement of code, the ultimate realization of "32-bit programs can be run in 64-bit systems" purpose.

The following is the author, the preliminary practice, only for colleagues reference:
1, for the unit involved in ASM code modification, the use of API replacement.
2, for some reference to read and write hardware units, most of the use of ASM code, dereference the class unit.
3. Do not use third-party controls whenever possible. In particular, a third-party control with no source code. (ASM code included)
4, the modified reading and writing hardware units, respectively, in the 64-bit machine, debugging. Main validation:
(1) can be run (support code).
(2) The return value of 32 bits is identical to 64 bits.

Through, the above code is improved. The compiled program. Run normally on 64 bits.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.