Monday 28 November 2011

Are Windows programs compatible from one compiler to the next? in C programming

Are Windows programs compatible from one compiler to the next?

All compilers available for development of Microsoft Windows programs must support the Microsoft Windows SDK (Software Development Kit), and therefore the Windows functions you use in your programs are compatible across compilers. A typical Windows program developed in standard C using only Windows API calls should compile cleanly for all Windows-compatible compilers. The functions provided in the Windows API are compiler-independent and easy to port between compilers such as Borland C++, Microsoft Visual C++, and Symantec C++.

Most of the Windows-based programs on the market today, however, use C++ class libraries to augment and simplify the complexity of using the Windows SDK. Some class libraries, such as Microsoft’s Foundation Class Library (MFC) and Borland’s ObjectWindows Library (OWL), are compiler-specific. This means that you cannot take a Windows program developed with MFC using Microsoft’s Visual C++ and port it to Borland C++, nor can you take a Windows program developed with OWL using Borland C++ and port it to Visual C++. Some class libraries, such as zApp and Zinc, are compiler-independent and are thus safer to use when multiple compilers must be supported.

Note that if you are using C++ for your Windows development, you should pay close attention to your compiler’s adherence to ANSI-standard C++, because there are different levels of support for ANSI C++ between compilers. For instance, some compilers have full support for C++ templates, whereas others do not. If you were to write a Windows program using templates, you might have a hard time porting your code from one compiler to another. Typically, though, if you are developing with ANSI-standard C and the Microsoft Windows API, your code should be 100 percent portable to any other Windows-compatible compiler.

Cross Reference:

None.

No comments:

Post a Comment