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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7661856b1d8dc0ab X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!a75g2000cwd.googlegroups.com!not-for-mail From: "Aurele" Newsgroups: comp.lang.ada Subject: Re: Calling Ada from C Date: 22 Feb 2007 12:40:09 -0800 Organization: http://groups.google.com Message-ID: <1172176809.443418.314420@a75g2000cwd.googlegroups.com> References: <1172159208.098190.143360@t69g2000cwt.googlegroups.com> NNTP-Posting-Host: 209.226.116.94 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1172176822 6999 127.0.0.1 (22 Feb 2007 20:40:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 22 Feb 2007 20:40:22 +0000 (UTC) In-Reply-To: <1172159208.098190.143360@t69g2000cwt.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: a75g2000cwd.googlegroups.com; posting-host=209.226.116.94; posting-account=n6Tb9Q0AAAD90b3f2J-7KdkYh1JNJvev Xref: g2news2.google.com comp.lang.ada:9429 Date: 2007-02-22T12:40:09-08:00 List-Id: On Feb 22, 10:46 am, "hannibal.h...@gmail.com" wrote: > I have a slight problem trying to call an Ada function from a C > function. I need to pass in an unconstrained array to the Ada > function. The problem is how I specify the size. > > This is probably very simple, but I am more or less just getting > started with Ada, comming from a C-background. > > My code yealds warnings like this (when compiled with GNAT): > > foo.ads:50:23: warning: type of argument "Insert_C.Packet" is > unconstrained array > foo.ads:50:23: warning: foreign caller must pass bounds explicitly > > I have been searching a lot in order to figure out what to do about > this, but all the FFI documentation is for calling C-functions from > Ada, and some very simple examples of how to call ada functions that > take primitive arguments (ints, and similar items). > > Anyone who know how to pass in the bounds explicitly? Have you thought of passing it as an acces "pointer" to your array?