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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dbe05983bbe093ca X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Interfaces.C.Strings_Chars_Ptr as an out mode parameter Date: 1999/06/11 Message-ID: <7jr9s1$ij8$1@nnrp1.deja.com>#1/1 X-Deja-AN: 488427117 References: <7jpe2e$m7i@hobbes.crc.com> X-Http-Proxy: 1.0 x29.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Fri Jun 11 15:27:09 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 1999-06-11T00:00:00+00:00 List-Id: In article <7jpe2e$m7i@hobbes.crc.com>, "David C. Hoos, Sr." wrote: > procedure My_Proc (Result : out Interfaces.C.Strings.Chars_Ptr); > > is it legal to export it like so: > > pragma Export (C, My_Proc, "My_Proc"); > > where the C prototype is void My_Proc (char * result); > > The results I'm having are that if the exported procedure > is called from Ada, everything works as expected. > > If called from C, a Segmentation fault occurs at the > point where the out mode parameter is assigned its > value in the Ada procedure My_Proc. If the implementation advice in the RM is followed, then your Ada "myproc" is equivalent to a C "My_Proc (char ** result)". To get the equivalent of a C "My_Proc (char * result)" you should either change your mode to "in" or change your type to "Interfaces.C.Signed_Char" -- T.E.D. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.