[build2] How to define a library implementing main()?

Boris Kolpackov boris at codesynthesis.com
Mon Sep 17 15:21:22 UTC 2018

Klaim - Joël Lamotte <mjklaim at gmail.com> writes:
> Anyway I would like to restart from another angle: how do you
> recommend, in general, such a library just implementing main would be
> defined and provided in build scripts?

I think it should always be a static library (so liba{} instead of lib{})
and we should by default link it in the "whole archive" mode to make sure
the object file that defines main() gets included. So something along
these lines:

liba{main}: cxx{main}
liba{main}: bin.whole = true

More information about the users mailing list