Reputation: 1009
I'm considering two options for a program. Either C++ with Boost Asynchronous IO or Java with the asynchronous NIO. I know that Java is portable so long as the system has the java run time. I'd prefer to use C++ with Boost but I'm not sure if the program I write can be ported to a different Windows machine and still run. What do I need to do to ensure that the program has all necessary dependencies at runtime? I plan on only using the windows.h, C++ 2003 standard, and the Boost libraries.
Upvotes: 3
Views: 272
Reputation: 54168
So long as you use Boost, the C++ Standard Library (and the CRT, if you feel you must), your code will port pretty easily.
Make sure you avoid any Microsoft CRT extensions such as the str*_s
functions (e.g. here) - MSDN does not flag these very well as nonstandard, unfortunately.
Also avoid using C++0x features in Visual C++ v10 to maximize portability in the short term - or check the other compilers you are targeting have the features you plan to use.
Be careful: If you use a bunch of stuff out of windows.h
, you will break portability and increase the work you need to do. Avoid this as much as possible if you do expect to port later, and if you do need anything from there, try to isolate the usage in distinct 'I need to change this when I port' header and code files of your own, so you know you only need to look at that subset of your code when porting to another OS.
Upvotes: 3
Reputation: 72519
boost and CRT can be linked statically to your executable, so there won't be any external dependencies at all.
Upvotes: 6