comp.lang.ada
 help / color / mirror / Atom feed
From: gressett@iglobal.net
Subject: Re: Another Newbie question about interfacing to C
Date: 2000/06/01
Date: 2000-06-01T00:00:00+00:00	[thread overview]
Message-ID: <cm2ejs8njjg8m01nkdqmc29ao6rnq7b7j7@4ax.com> (raw)
In-Reply-To: okrdjsk4klohs5gv3890nbk5ee7199tbnm@4ax.com

David Gressett <gressett@iglobal.net> wrote:

>I need to communucate with a C routine that takes an array of char *
>as an argument, i.e., it is prototyped as
>
>void someroutine(char *things[]);
>
>The problem is that the component elements of  things are not
>necessarily pointers to char;  they could be pointers to something
>else that have been cast to pointers to char. someroutine has access
>to information that tells it exactly which type is pointed to by the
>elements of things[].
>
>The original programmer of this routine used this technique to pass
>arguments of arbitrary type to the routine someroutine. The types are
>known at compile time, and their order in things[] is significant.The
>number of elements in things[] is unlimited.
>
>Is there a reasonable Ada way to pass arguments of arbitrary type to
>an Ada routine? It need not look very C-ish. 


Hmmm. Further study of the Cohen book causes me to believe that a
discriminant record type is what I need. It's interesting how C habits
can lead you into not seeing Ada stuff that is right under your nose.




  reply	other threads:[~2000-06-01  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-01  0:00 Another Newbie question about interfacing to C David Gressett
2000-06-01  0:00 ` gressett [this message]
2000-06-02  0:00   ` Marin D. Condic
replies disabled

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