Contracts in library code
bearophile
bearophileHUGS at lycos.com
Tue Dec 28 03:22:55 PST 2010
To solve the problem with Contracts in library code (like in Phobos or in user-created libraries) is it possible to let DMD (asking it with a compiler switch, I presume) compile and put inside the library two versions of each function/method, with differently mangled names?
So when you import and use compiled functions from Phobos the linker uses the version of the function with or without Contract assertions according to the compilation switches (like -release) you have used.
Having a twice bigger Phobos lib in the standard DMD distribution is not a problem, and the linker doesn't include the wrong functions, so the final executable sizes are unchanged.
Bye,
bearophile
More information about the Digitalmars-d
mailing list