Porting Code to a Different Compiler

Porting Code to a Different Compiler

I receive many questions from readers asking for guidance on how to port an existing C++ app to a different compiler or platform. Porting software can be very easy or very difficult, depending on several factors. The most important one is the extent to which the software relies on non-portable or compiler-specific features. For example, if your code uses non-standard keywords such as __closure (in Borland’s C++ Builder) and __int64, you will have to replace them with the equivalent keywords supported by target compiler. Using standard constructs that have the same semantics instead of proprietary keywords is even better.

Porting is more difficult if your app is based on a proprietary framework such as MFC or DCOM which your target platform, e.g., Unix, doesn’t support. In situations like these, you need to perform code analysis and separate portable code components (e.g., business logic classes, financial and arithmetic functions, standard functions and classes) from non-portable GUI and platform API components. The portable components can be used as is on the target platform. As for the non-portable components?it’s likely that your target platform offers a corresponding set of classes or API functions that you can use instead. For example, instead of the spawn() family of functions used in Win32, you can use the exec() or fork() functions in Unix and Linux. Sometimes, however, you will have to redesign parts of your app from scratch.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several