From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1bad2c41a59ed9b8 X-Google-Attributes: gid103376,public From: tojst1+@pitt.edu (Tore Joergensen) Subject: Re: GNAT, OS/2, Libraries Date: 1996/04/11 Message-ID: <4khkr1$5bt@usenet.srv.cis.pitt.edu>#1/1 X-Deja-AN: 146823252 references: <4kgf38$qaa@fnnews.fnal.gov>,<4kgpjs$r6@usenet.srv.cis.pitt.edu> <4khbj7$hbq@fnnews.fnal.gov> organization: University of Pittsburgh newsgroups: comp.lang.ada Date: 1996-04-11T00:00:00+00:00 List-Id: Robert Morphis (morphis@fnalv1.fnal.gov) wrote: : sigh, I ask a question and then get more confused. I can guess what a : binding is but a "thin binding"? (why do I feel like I am way over my : head? :) An example: -- This function draws a section of the segment chain. function GpiDrawFrom( a_hps : HPS; -- Presentation-space handle lFirstSegment : LONG; -- First segment to be drawn; it must be -- greater than 0 lLastSegment : LONG) -- Last segment to be drawn; it must be -- greater than 0 return BOOL; -- Success indicator (rc) pragma Import( Convention => C, Entity => GpiDrawFrom, Link_Name => "_GpiDrawFrom"); This was a thin binding. It gives minimum overhead (I'm not sure if it will generate more code than the same call from a C-program or not), and doesn't add any protection. A thick binding would probably change it into a procedure, and raise an exception if the C-call return 0 (false). It would use an Ada-type that protected against values of 0 or lower for the parameters, or maybe change the parameters completely if that was more appropriate. One call in a thick binding may result in several calls to the thin binding. A thick binding may use a controlled type for something, and use the thin binding's create and delete calls as Initialize and Finalize. A thick binding involves code, while a thin binding just give you a name and parameter-list so you can call it from within an Ada-program. To put it simple, a thin binding gives you Ada functions and procedures that feels like C-functions (if it is a C-library). A thick binding will give you Ada look and feel :-). -- +-------------------------+-------------------------------------------+ | Tore B. Joergensen | e-mail : tore@lis.pitt.edu | | Centre Court Villa | web : http://www.pitt.edu/~tojst1 | | 5535 Centre Avenue # 6 | | | Pgh, PA 15232, USA | Norwegian MSIS-student at Univ. of Pgh. | +-------------------------+-------------------------------------------+