'version'-based code selection
Yatheendra
3df4 at gmail.ru
Sat Jun 1 03:59:13 UTC 2019
Hi people.
The 'version' keyword sounds like a fantastic capability, but how
far does DMD take it (and does GDC take it equally far)? This is
not a "D Improvement Proposal", I am just asking how it is now.
Can code of multiple versions be compiled into the same
executable or library, and a particular one selected from
"later"? I guess not without some name mangling and wrangling.
Can such selection be done at link-time for standard as well as
user-defined library code? Maybe some library file naming
conventions are followed to allow the compiler to select the
corresponding file?
Wishful thinking, but can the selection be at runtime? That would
be language support for making some things easy, e.g. picking
from assembly-coded routines based on runtime CPU id (the video
player MPlayer picks routines that way, and I read that the D
library, Mir, has CPU id support).
Thanks.
P.S: I am a brand-new C++'y asylum seeker who may have missed
seeing some documentation, so RTFM is a valid response.
P.P.S: This question was triggered by the D GSoC project for
independent-of-C implementations of malloc/free/memcpy/memset.
Could a common malloc be exposed to the D
runtime/Phobos/programs, with the C or D implementations
selectable at link-time (using a mechanism available to user code
too)?
More information about the Digitalmars-d-learn
mailing list