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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9e124b142a146211 X-Google-Attributes: gid103376,public From: gressett@iglobal.net Subject: Re: Another Newbie question about interfacing to C Date: 2000/06/01 Message-ID: #1/1 X-Deja-AN: 630070930 Content-Transfer-Encoding: 7bit References: Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsabuse@supernews.com Organization: Posted via Supernews, http://www.supernews.com MIME-Version: 1.0 Reply-To: gressett@iglobal.net Newsgroups: comp.lang.ada Date: 2000-06-01T00:00:00+00:00 List-Id: David Gressett 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.