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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,32d4b7099c3e0137 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-20 14:56:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail Reply-To: "James S. Rogers" From: "James S. Rogers" Newsgroups: comp.lang.ada References: Subject: Re: C code to Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Mon, 20 Jan 2003 22:56:15 GMT NNTP-Posting-Host: 12.86.35.98 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1043103375 12.86.35.98 (Mon, 20 Jan 2003 22:56:15 GMT) NNTP-Posting-Date: Mon, 20 Jan 2003 22:56:15 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:33256 Date: 2003-01-20T22:56:15+00:00 List-Id: I looked in the GNAT file i-cstrea.ads. It defines the following (just an excerpt from the file) package Interfaces.C_Streams is pragma Preelaborate; -- Note: the reason we do not use the types that are in Interfaces.C is -- that we want to avoid dragging in the code in this unit if possible. subtype chars is System.Address; -- Pointer to null-terminated array of characters subtype FILEs is System.Address; -- Corresponds to the C type FILE* subtype voids is System.Address; -- Corresponds to the C type void* It appears that you can correctly use System.Address on to bind to a C void*. Jim Rogers "chris.danx" wrote in message news:e2_W9.3074$Ts5.30248@newsfep4-win.server.ntli.net... > sk wrote: > > Hi, > > > > I had a binding (lost due to a misplaced "mkfs /dev/...") > > oops! > > > but I am not sure where you are getting the "__THROW" > > from. > > from /usr/include/dlfcn.h > > > > When I was playing with shared-libraries etc (based on the > > Linux-Documentation-Project Program-Library-HOWTO), I did > > "man dlopen" and bound to the functions specified > > > > From "man dlopen" ... > > Cheers will look at that! > > > > #include > > > > void *dlopen(const char *filename, int flag); > > > > So ... > > > > ICS => Interfaces.C.Strings; > > IC => Interfaces.C; > > > > procedure Dlopen ( > > Name : ICS.Chars_Ptr; -- <= Assign with ICS.New_String > > Mode : IC.Int > > ); > > > I don't understand this. Why procedure? The return type of dlopen is > not void (a procedure), but void* (a pointer to an unknown object - > unknown to the client because dereferencing directly on void* isn't > allowed; you have to cast it before you can dereference it). It's where > you get the handle from and what's causing me the most problems. > > > > procedure Dlsym (Handle : System.Address; Symbol : IC.Char_Array) > > > > function Dlclose return IC.Int; > > > > Translating > > "(void)" typically translates to parameterless function/procedure > > "void function-name" typically translates to an Ada procedure > > See above. > > > > The best source I found dealing with dl* is in the above mentioned > > howto. With some care, the special library functions "init" > > and "fini" can be nicely related to "adainit" and "adafinal" > > needed to make a stand-alone shared/dynamic library all using > > Ada and GNAT :-) > > I don't understand but I'll look at this a little later. > > > Thanks, > Chris > -- > for personal replies change spamoff to chris >