comp.lang.ada
 help / color / mirror / Atom feed
From: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
Subject: Re: Calling C time function from ADA-95
Date: 1998/06/07
Date: 1998-06-07T00:00:00+00:00	[thread overview]
Message-ID: <357A6297.24954982@cl.cam.ac.uk> (raw)
In-Reply-To: 3579da75.13533758@enews.newsguy.com


Faust! wrote:
> Looking for a way to call out to time.h for system clock information
> from Ada-95.....

For easy POSIX and C API access, you should install a POSIX.5 binding.
A freely available one is FLORIST on

  http://www.cs.fsu.edu/~baker/florist.html

Without such a binding, portable access to C/POSIX libs is rather messy
in Ada, because Ada doesn't allow you to access the preprocessor
constants in *.h files and you have to copy them manually or write
an install skript that transforms .h files into .ads files. Bindings
such as FLORIST have all these constants converted for you into
Ada constants and you can then use them in a portable way. In
addition, reading the FLORIST source code is a good way of learning
how to write mixed Ada/C programms. Have a look at it.

I don't use Florist at the moment, because it does not run
on new Linux systems with glibc2 (e.g., Red Hat 5.0). What I
do is to cut and paste from Florist my own POSIX binding together
with only the functionality that I need in my application.
This works very nicely, and since I use the same API, I can
easily throw away my own binding and replace it by the full
Florist package once it runs on Red Hat 5. Even if Florist does
not yet run on your OS, the posix.ads and posix-c.ads files
that it installs are *very* valuable sources of cut-and-paste
material for your own quick-n-dirty bindings.

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




      parent reply	other threads:[~1998-06-07  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-07  0:00 Calling C time function from ADA-95 Faust!
1998-06-06  0:00 ` Matthew Heaney
1998-06-08  0:00   ` Charles Hixson
1998-06-08  0:00     ` Dale Stanbrough
1998-06-08  0:00       ` Larry Kilgallen
1998-06-09  0:00       ` Markus Kuhn
1998-06-09  0:00         ` Charles Hixson
1998-06-09  0:00           ` Markus Kuhn
1998-06-09  0:00             ` Charles Hixson
1998-06-12  0:00               ` Larry Kilgallen
1998-06-07  0:00 ` Markus Kuhn [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox