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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d187dd741b987313,start X-Google-Attributes: gid103376,public From: "W. Wesley Groleau (Wes)" Subject: Re: Ada/Motif problem Date: 1996/08/28 Message-ID: <9608281459.AA06806@most>#1/1 X-Deja-AN: 177164847 sender: Ada programming language comments: Gated by NETNEWS@AUVM.AMERICAN.EDU mailer: Elm [revision: 70.85] newsgroups: comp.lang.ada Date: 1996-08-28T00:00:00+00:00 List-Id: If the Motif libs were compiled with gcc then the following should work with GNAT: HW : constant String := "Hello World" & ASCII.NUL; begin Xt.Intrinsic.XtAddCallback ( pb, Motif.et_cetera, hello.et_cetera'access, HW'Address ); as long as you ensure that HW is ALWAYS in scope. I've obviously never tried it with Ada-83, but that method for sending a string to C works with several C compilers and Ada-83 compilers. OOPS, I just realized you're trying to send it BACK to Ada. Yes, you lose bounds info, but you can sort of get them back as follows: in callback: Local_HW : contant String := String_From_C ( the_thing_that_came_from_C ); where String_From_C is provided (with a different name) by most vendors, but is basically Temp : String ( 1 .. some_arbitrary_limit ); for Temp'Address use the_thing_that_came_from_C; ... for I in Temp'Range loop if Temp(I) = ASCII.NULL then return Temp ( Temp'First .. I-1 ); end if; end loop; --------------------------------------------------------------------------- W. Wesley Groleau (Wes) Office: 219-429-4923 Hughes Defense Communications (MS 10-40) Home: 219-471-7206 Fort Wayne, IN 46808 (Unix): wwgrol@pseserv3.fw.hac.com ---------------------------------------------------------------------------