comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Help interfacing C
Date: 2000/07/26
Date: 2000-07-26T00:00:00+00:00	[thread overview]
Message-ID: <jSGf5.29$LV1.41447@news.pacbell.net> (raw)
In-Reply-To: 8ljlti$7u0$1@polaris.inta.es

> int  zzz_VaSend (zzz_mbox_cap mbox_c, int send_type,
>                  int flag, int len, char *buf , char *va_list, ...);

You could use overloading
  function f(some_params:some_type; a:another_type);
  function f(some_params:some_type; a,b:another_type);
  function f(some_params:some_type; a,b,c:another_type);
That works well if you usually only have a few items in the variable
parameter list.

Or, since Ada allows easy creation of temporary arrays, you could do
  function f(some_params:some_type; list : array_type);
and then call it with
  f(x, (1=>a));  -- perhaps replaced with something like the 1st f above.
  f(x, (a,b));
  f(x, (a,b,c));
  etc.

Your function(s) will of course have to transmit their parameters
appropriately to the C function.  You will need separate pragma
Imports for the C function for each number of parameters.




  parent reply	other threads:[~2000-07-26  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-25  0:00 Help interfacing C Jes�s M. Mil�n-Franco
2000-07-25  0:00 ` Keith Thompson
2000-07-26  0:00 ` tmoran [this message]
2000-07-26  0:00   ` Keith Thompson
2000-07-26  0:00 ` Ken Garlington
replies disabled

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