comp.lang.ada
 help / color / mirror / Atom feed
* How to simplify writing C bindings with GNAT.
@ 2003-08-02 21:38 Freejack
  0 siblings, 0 replies; only message in thread
From: Freejack @ 2003-08-02 21:38 UTC (permalink / 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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-02 21:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-02 21:38 How to simplify writing C bindings with GNAT Freejack

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