comp.lang.ada
 help / color / mirror / Atom feed
From: Freejack <freejack@nospam.net>
Subject: How to simplify writing C bindings with GNAT.
Date: Sat, 02 Aug 2003 21:38:09 GMT
Date: 2003-08-02T21:38:09+00:00	[thread overview]
Message-ID: <pan.2003.08.02.21.44.08.712097.1106@nospam.net> (raw)

I'm finding that most of the C types I'm using already have an Ada
mapping set up in the GNAT compiler and runtime.The only thing one really
needs to dick with are strings and sometimes access/pointer types. The
runtime is doing a lot of the tedious work for me.

I'm assuming that's because the GNAT environment binds to the native
glibc that I have installed on my machine.

So, for anyone writing bindings, if the datatype in the C package your
writing a binding for corresponds to a type defined on the native 
platform, try using the GNAT type, you may be pleasantly surprised.
GNAT may already have the type imported.
Examples include such things as file descriptors, mode flags, etc...

However, if you want to go beyond that, such as using Posix permissions,
getting process IDs, etc... You'll have to define those yourself.

I'm not sure if this works for other compilers though.( GreenHills,
Aonix, etc...).

Is it the same on the Win32 platform?

Anyways..just a tip.

Freejack.



                 reply	other threads:[~2003-08-02 21:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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