Compile once, run anywhere – Portable cheminformatics applications

Often when you install C++ software, a number of different DLLs are installed along with the principal one. For example, if you install Open Babel on Windows, as well as the Open Babel core DLL there are DLLs for cairo, png, xml2 and various plugin DLLs for Open Babel functionality. In theory this allows the user to swap in a new version of a DLL or remove particular plugins that are unnecessary. In general, however, this flexibility is not exploited and for most users this is all just clutter. A better user experience might be to present a single file containing all of the necessary functionality. This is something I’ve been working on recently for our own software.

As another step towards portable applications, we have been moving away from using MSVC to using MinGW (and now MinGW-64) to statically compile our software. With the right flags a C++ application can be created that statically includes the C++ runtime and so is no longer dependent on the infamous MSVC++ runtime DLLs (which may or may not be present), or on any Cygwin or MinGW DLLs. As a result, it will run on any Windows version from WinXP onwards.

When you figure out how to generate these statically-linked libraries and applications, they work just great. Getting to that point is a bit tricky though. Luckily for me we have some in-house expertise (“ROGER – it’s happened again!”). The following presentation which I gave as a lightning talk at the recent RDKit UGM gives an overview of the approach and rationale:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.