On Monday, 18 January 2021 at 02:24:59 UTC, Jack wrote:
I know I can set version but I'd looking for a native way, if any, to do that. Is possible to tell if output binary is library or executable at compile time? then I'd call different version of a function.

Add `-version=library` to your compiler flags for the library and `-version=executable` to your compiler flags for the executable. Then, in the code, you can check for `version (library)` and `version (executable)`.

Before you ask: no, there is no "more native" way to do this, because there is actually no difference in how the code is compiled between the two versions. The distinction between library and executable is only made when the compiled code is linked.

Reply via email to