From: Christopher Broeg <broeg@astro.uni-jena.de~>
Subject: Re: trying to call HDF5 from ada -- problems with constants
Date: Thu, 26 Aug 2004 13:46:12 +0200
Date: 2004-08-26T11:46:12+00:00 [thread overview]
Message-ID: <cgkii4$lga$1@fsuj29.rz.uni-jena.de> (raw)
In-Reply-To: <npjXc.72379$mD.37369@attbi_s02>
Jeff C, wrote:
> "Christopher Broeg" <broeg@astro.uni-jena.de~> wrote in message
> news:cgk5i0$cfu$1@fsuj29.rz.uni-jena.de...
>
>>What is the standard way to import C constants that are not "constant"
>>from one run to the next, but derived from some "invisible" library in the
>>.h files?
>
>
>
> If they really vary from one run to the next then I think you have no choice
> but to build bindings to C functions that return them. Alternatively
> assuming you have enough of the source you could recreate the code that
> builds
> the constants via macros from C code.
>
>
> If the constants vary from platform to platform but not run-to-run you can
> use an approach like AdaSockets does
> where it builds the ada spec on the fly during the configure step using
> constants.sh and constants.c
> (see the Adasockets distribution)
> http://www.rfc1149.net/devel/adasockets
>
>
tx. I just realized that with gnat I can import the constants directly.
I realized that the ada specifications in the RM do never explicitly
mention functions or procedures with respect to pragma import. So I did:
H5T_STD_I32BE_g : Hid_t;
pragma Import(C,H5T_STD_I32BE_g , "H5T_STD_I32BE_g");
and it works! All you have to do is call H5open manually, which is done
automatically with the c preprocessor. Is this behaviour
compiler-dependant, or ADA standard?
I'm surprised, because there was this long thread on this very topic
explicitly stating that ada cannot import c constants... But I guess it
only referred to preprocessor constants. All "variing" constants are of
course real c constants visible in the library.
Thanx a lot for the reply.
Chris
next prev parent reply other threads:[~2004-08-26 11:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-25 13:38 trying to call HDF5 from ada -- problems with constants Christopher Broeg
2004-08-25 16:35 ` Brian Catlin
2004-08-26 8:04 ` Christopher Broeg
2004-08-26 11:00 ` Jeff C,
2004-08-26 11:46 ` Christopher Broeg [this message]
2004-08-26 18:29 ` Ludovic Brenta
2004-08-26 19:20 ` Randy Brukardt
2004-08-27 0:54 ` Jeffrey Carter
2004-08-27 11:32 ` Christopher Broeg
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox