comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: Thick vs. Thin bindings
Date: Sat, 27 Nov 2004 08:25:21 +0100
Date: 2004-11-27T08:25:21+01:00	[thread overview]
Message-ID: <1277697.NJH4qpXlWW@linux1.krischik.com> (raw)
In-Reply-To: 41a746a0@x-privat.org

Jeff Houck wrote:

> As I continue to evaluate Ada in the role of a gamephilosophyge, I've
> run across references to "thick" and "thin" bindings and I'm a bit
> confused.
> My initial design goals are to keep the number of external dependancies
> to a minimum with most of the support code written in Ada. I would like
> the code interfaces to be as simple as possible to implement for a
> designer. I believe this would necessitate a "thick" binding. Is that
> correct? Would anyone like to elaborate on the pros and cons of these
> two binding methodologies? Further reading material? Tutorials? Thx!

A thin binding just translates the C calls into Ada calls but the C'ish
philosophy is still visible. One examle of C'ish philosophy is the '\0' at
the end of strings.

Example for a thin binding to memset:

   procedure memset (
      S : in Interfaces.C.void_ptr;
      C : in Interfaces.C.int;
      N : in Interfaces.C.size_t);

   pragma Import (
      Convention    => C,
      Entity        => memset,
      External_Name => "memset");

A think binding translates the philosophy of the original language to Ada as
well.

A think binding to memset could be a generic procedure (template in C++
talk):

generic
   type A_Type    is private;
   type A_Access is access all A_Type;
procedure Mem_Set    
      Value : in A_Access ;
      Fill : in Short_Short_Integer);

I usualy suggest to build a think binding on top of a thin bindung.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



  parent reply	other threads:[~2004-11-27  7:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-26 15:07 Thick vs. Thin bindings Jeff Houck
2004-11-26 16:55 ` Marius Amado Alves
2004-11-27 18:13   ` Jeff Houck
2004-11-27 22:16     ` Marius Amado Alves
2004-11-26 19:32 ` David Botton
2004-11-27  7:25 ` Martin Krischik [this message]
2004-11-29  7:50 ` tmoran
2004-12-01 17:14 ` Preben Randhol
replies disabled

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