September 18 [Issue 24769] New: Add pragma compile on import | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24769 Issue ID: 24769 Summary: Add pragma compile on import Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: alphaglosined@gmail.com Sometimes it is useful to have modules that are always compiled into each binary that uses them. These import-only modules should be able to be imported by setting the import path, and the compiler will if it is used compile it in. A pragma in the module can specify this behaviour ``pragma(compileonimport);``. The existing solution for this is to use the ``-i`` switch. This may be a useful addition wrt. the proposed phobos.sys.* package, that could be import only. The only catch is the object file will need to enable multiple definitions to prevent linker errors. -- |
Copyright © 1999-2021 by the D Language Foundation