comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com (Ted Dennison)
Subject: Re: thick? thin? binding
Date: 20 Jun 2002 07:12:35 -0700
Date: 2002-06-20T14:12:36+00:00	[thread overview]
Message-ID: <4519e058.0206200612.5ab7906b@posting.google.com> (raw)
In-Reply-To: aeqjst$96ip3$1@ID-100557.news.dfncis.de

Immanuel Scholz <news@kutzsche.net> wrote in message news:<aeqjst$96ip3$1@ID-100557.news.dfncis.de>...

> I read through 1 and a half Ada book and still doesnt catch what "thick" or 
> "thin" binding mean... I know "flat" binding from C or "name mangling" from 

A thin binding to a C library would be a package spec that contains a
bunch of subprograms that are "pragma interface"ed directly to the C
(or STDCALL or whatever) routines. Their parameters must be set up so
that C can process them correctly (strings must end with a null
character, etc.) Typically the names of the routines would be exactly
the same as the C routines, and you could just use the C
documentation.

A thick binding to a C library would present an interface of Ada
routines that take Ada-style data (no pointers, strings where every
character is valid and there is no terminiating null character, etc).
Typically they will also be much higher-level than the C facilities,
abstracting away much of the cruft (and perhaps some of the
functionality). The names of the subprograms may not bear much
relation to the C routine(s) they call, so a thick binding needs its
own documentation.

I usually try to operate in a middle ground ("semi-thick"), where each
C routine has a corresponding Ada routine whose job is to translate
Ada types and idoms into C types and idoms (and visa versa), and to
call the C routine. That way you don't loose functionality, but you
don't infect your Ada code with C stuff either. You still don't need
any new documentation for such a binding, as long as you comment what
C routines are called by what Ada routines.



  parent reply	other threads:[~2002-06-20 14:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-19 18:53 thick? thin? binding Immanuel Scholz
2002-06-19 19:22 ` tmoran
2002-06-19 19:27 ` Stephen Leake
2002-06-19 19:50   ` Immanuel Scholz
2002-06-19 20:25     ` tmoran
2002-06-19 19:27 ` chris.danx
2002-06-19 19:28 ` Stephen Leake
2002-06-20 14:12 ` Ted Dennison [this message]
2002-06-21  1:29   ` David Emery
2002-06-26  0:23     ` tmoran
replies disabled

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