comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Interfacing to C: API with macros
Date: Tue, 12 Jun 2007 13:17:29 -0700
Date: 2007-06-12T13:17:29-07:00	[thread overview]
Message-ID: <1181679449.352274.217590@g37g2000prf.googlegroups.com> (raw)

Yet Another Problem (YAP): consider a C function that is defined
together with some helper macros. Motivating example: select(2) system
call, with its FD_XXX helper macros.

(it is unspecified whether FD_XXX helpers are macros or functions, but
we can assume the worst)

There is no way to pragma Import(C, FD_SET) and the binary layout of
fd_set data structure is not specified, so we cannot fake it with Ada.

Again, the straightforward solution: thin wrapper in C, that itself is
simple enough to be easily imported by Ada code.

Again: is this THE solution?

Looks like in order to write any nontrivial system software the poor
Ada programmer has to start with an awful lots of wrappers - where is
maintainability and productivity when you need them? ;-)

--
Maciej Sobczak
http://www.msobczak.com/




             reply	other threads:[~2007-06-12 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12 20:17 Maciej Sobczak [this message]
2007-06-12 20:25 ` Interfacing to C: API with macros Lutz Donnerhacke
2007-06-13  0:18 ` tmoran
2007-06-13 14:06 ` Steve
replies disabled

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