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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,93621d2e1565f597 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-23 23:18:49 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: jeff.huter@bigfoot.com (Jeff) Newsgroups: comp.lang.ada Subject: Re: Providing C function With Argv Date: 23 Jul 2002 23:18:49 -0700 Organization: http://groups.google.com/ Message-ID: References: <3d3d0fdd@news.ecs.soton.ac.uk> NNTP-Posting-Host: 68.98.43.219 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1027491529 26439 127.0.0.1 (24 Jul 2002 06:18:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 24 Jul 2002 06:18:49 GMT Xref: archiver1.google.com comp.lang.ada:27347 Date: 2002-07-24T06:18:49+00:00 List-Id: Thanks Ken, The CArgv and CHelper packages of TASH did the trick. I only wish I found them sooner. It would have saved many hours of hacking in my feeble attempt to accomplish what I thought should be an "easy" task. Oh well. Live and learn. One bright spot is that I wasn't too far off. While CArgv and CHelper are much more elegant, my approach was similar and probably would have worked with some minor corrections. However, I decided to use the CArgv and CHelper packages because they provide functions which should be helpful in accomplishing my thin port. Thanks again, Jeff "Ken Thomas" wrote in message news:<3d3d0fdd@news.ecs.soton.ac.uk>... > Take a look at the interface to TCL (tash802), there is a package "Cargv" > that does the job. > http://unicoi.kennesaw.edu/ase/ase02_02/bindings/tash/ > > Ken Thomas > > "Jeff" wrote in message > news:fe4bb2c2.0207220726.7502e4bd@posting.google.com... > > I'm in the process of extending/porting a C program to Ada. I have an > > Ada main program that needs to call a C function with the parameters > > int argc, char **argv. With Ada.Command_Line, I've been able to pass > > the C function with int argc. Using Interfaces.C.Strings, I have even > > been successful supplying a modified version of the C function with a > > Interfaces.C.Strings.chars_ptr to provide the function with a single > > string Argument. However, I can't seem to figure out how to construct > > and pass the equivalent of a C char ** in order to pass all the > > arguments at once. My guess is that I need to use > > Interfaces.C.Pointers to construct a Pointer to chars_ptr. But I've > > had no luck with this approach. > > > > How does one pass a C function the eqivalent of char **? Is there any > > easier way to accomplish this than to construct the char **argv from > > Ada.Command_Line.Argument? Working code would be much appreciated > > since I'm rather new to Ada.