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.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,dbe05983bbe093ca,start X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Interfaces.C.Strings_Chars_Ptr as an out mode parameter Date: 1999/06/10 Message-ID: <7jpe2e$m7i@hobbes.crc.com>#1/1 X-Deja-AN: 488088664 Organization: Coleman Research Corporation X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 Newsgroups: comp.lang.ada Date: 1999-06-10T00:00:00+00:00 List-Id: RM B.3.1 (1) may have something important to say by what it does _not_ say, viz. : The package Interfaces.C.Strings declares types and subprograms allowing an Ada program to allocate, reference, update, and free C-style strings. In particular, the private type chars_ptr corresponds to a common use of �char *� in C programs, and an object of this type can be passed to a subprogram to which pragma Import(C,...) has been applied, and for which �char *� is the type of the argument of the C function. What is does _not_ say is that an object of this type can be passed to a subprogram to which pragma Export(C,...) has been applied, and for which �char *� is the type of the argument of the C function. So... the question is.. if one wishes to have a procedure with a profile of, say: 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. What say ye?