20 ms·
I will assume by 'low level' you mean C/C++. Writing cross platform code at the system interface level is usually only something you do because you have to not
by generic_user 10y ago
I will assume by 'low level' you mean C/C++. Writing cross platform code at the system interface level is usually only something you do because you have to not something you do because you want to. It can be quite tedious and some times close to impossible. lets narrow the question to just C. And lets also narrow the specification to 'native' system interfaces. Lets also limit our operating systems to UNIX, Linux and Windows.
The goal of standardisation for C was in part to aid portability. That worked out to some degree. So thats the best place to start. The goal of POSIX was to standardize UNIX system interfaces across the various flavors. That worked out to some degree also. You also need to to get the interfaces for Windows, Linux and so forth because they all have various 'innovations' that have been created which are not adherent to any standard or portable.
At a minimum you should become familiar with the fallowing material.
* ISO/IEC 9899:1999 - ISO/IEC 9899:2011
http://www.open-std.org/jtc1/sc22/wg14/ http://www.open-std.org/jtc1/sc22/wg14/
* POSIX.1-2008 / IEEE Std 1003.1
http://pubs.opengroup.org/onlinepubs/9699919799/ http://pubs.opengroup.org/onlinepubs/9699919799/
* Linux system interfaces
http://man7.org/linux/man-pages/ http://man7.org/linux/man-pages/
* Win API/Win32 API
https://msdn.microsoft.com/en-us/library/windows/desktop/ff818516(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ff8...
Thats a lot of reading. A good starting point for a project is to code to the C standard and one abstract interface that wraps your main target OS. Then port portions of the implamentation for your interface to the various systems you need to run on. In reality there are a lot of specific factors that you need to take into account to design your portability strategy.
- ahpaja 10y agoThanks very much for this! I have been poking around a bit this week and this is indeed what I need. :) More importantly, where you say "A good starting point for a project..." is exactly the kind of know-how and practical advice that I have found hard to come by in this area of software engineering. Any idea on where to find more of it (blogs, articles) would be always welcome.
- panic 10y agoIt's worth noting that Microsoft Visual Studio doesn't have very good C support: it still doesn't support all of C99. You can either use clang as a frontend on Windows (https://blogs.msdn.microsoft.com/vcblog/2015/12/04/clang-with-microsoft-codegen-in-vs-2015-update-1/ https://blogs.msdn.microsoft.com/vcblog/2015/12/04/clang-wit...) or use C++: almost all of C++11 is supported (https://msdn.microsoft.com/en-us/library/hh567368.aspx https://msdn.microsoft.com/en-us/library/hh567368.aspx).