From: Felix Krause <usenet@flyx.org>
Subject: Exclude parts of a package
Date: Thu, 5 Dec 2013 21:13:50 +0100
Date: 2013-12-05T21:13:50+01:00 [thread overview]
Message-ID: <52a0de7e$0$23162$2c885b36@post.eweka.nl> (raw)
In C, I have the possibility to switch parts of my code on or off with
preprocessor defines. What would be the Ada way to do something like
that?
I know that I can use scenario variables with gprbuild. This works well
if I want to include or exclude whole packages (because I can include
or exclude certain files), but it does not work if I just want to
exclude certain subroutines from a package.
Take for example OpenCLAda: The user of the library should be able to
choose which version of the OpenCL API he wants to use (1.0, 1.1, …).
This choice should result in subroutines added in newer versions not
being available.
Excluding newer functionality is vital because if the user just takes
care about not using it, the wrapper will still link against the newer
C functions and thus the resulting binary cannot run on a system with
an older implementation - even though the implementation provides all
functionality the application needs.
One approach might be to implement all functions that are not part of
OpenCL 1.0 with "separate", place the implementation files in
subfolders "1.1", "1.2"… and provide an implementation for older
versions which raises an exception at runtime. But I'm not satisfacted
with that approach because the error is already discoverable with
knowledge available at compile-time.
Is there any better way to do it?
--
Felix Krause
http://flyx.org/
next reply other threads:[~2013-12-05 20:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 20:13 Felix Krause [this message]
2013-12-06 1:58 ` Exclude parts of a package gautier_niouzes
2013-12-06 7:51 ` Chris Moore
2013-12-06 8:04 ` playerdark
2013-12-06 11:14 ` Brian Drummond
2013-12-06 11:14 ` Brian Drummond
2013-12-06 11:41 ` Brian Drummond
2013-12-06 20:48 ` Felix Krause
2013-12-06 21:27 ` Shark8
2013-12-07 8:41 ` Felix Krause
2013-12-07 11:55 ` Brian Drummond
2013-12-08 20:00 ` Stephen Leake
2013-12-12 14:30 ` Marius Amado-Alves
2013-12-13 13:16 ` Felix Krause
2013-12-13 16:17 ` Stephen Leake
2014-01-02 15:06 ` Marius Amado-Alves
2014-01-02 15:07 ` Marius Amado-Alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox