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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,23ca868289d9f0c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: generic package with procedure paramter gives "not subtype conformant with declaration" References: <1159651201.121690.130430@b28g2000cwb.googlegroups.com> <1159682538.644835.248030@m7g2000cwm.googlegroups.com> <3UUTg.1003037$084.701942@attbi_s22> <1159738009.962575.108920@i42g2000cwa.googlegroups.com> <1159763506.841048.175930@m73g2000cwd.googlegroups.com> In-Reply-To: <1159763506.841048.175930@m73g2000cwd.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1159819475 12.201.97.213 (Mon, 02 Oct 2006 20:04:35 GMT) NNTP-Posting-Date: Mon, 02 Oct 2006 20:04:35 GMT Date: Mon, 02 Oct 2006 20:04:35 GMT Xref: g2news2.google.com comp.lang.ada:6844 Date: 2006-10-02T20:04:35+00:00 List-Id: cl1 wrote: > > Genius, pure genius! :D Thanks. More accurately, experience and a desire to be portable whenever possible. > For anyone who is curious. This crazy code is being implemented so that > you can call variable argument c functions. It interfaces with ffcall's > avcall which is like, as they describe, av_list in reverse. So far I > have the code that autogenerates wrappers for the avcall macros. The > code I orginally posted is the code to store all the parameters to the > variable argument C function. The process for a user of my packages > should be: I guess you have to handle any number of arguments. For specific or commonly used cases, you can declare multiple Ada subprograms, each with different numbers or types of parameters, that all pragma Import the same C function. Since you're generating packages for your clients, perhaps it would be easier on your clients if you generated such specific subprograms for them. For example: package C renames Interfaces.C; procedure Print_Str (Format : in C.Char_Array; Str : in C.Char_Array); pragma Import (C, Print_Str, "printf"); procedure Print_Int (Format : in C.Char_Array; Num : in C.Int); pragma Import (C, Print_Int, "printf"); procedure Print_Str_Int (Format : in C.Char_Array; Str : in C.Char_Array; Num : in C.Int); pragma Import (C, Print_Str_Int, "printf"); -- Jeff Carter "It's all right, Taggart. Just a man and a horse being hung out there." Blazing Saddles 34