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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d9b3c3805447df X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Interfaces.C Date: 1996/08/11 Message-ID: <01bb8790$54d1da20$368371a5@dhoossr.iquest.com>#1/1 X-Deja-AN: 173522819 distribution: world references: content-type: text/plain; charset=ISO-8859-1 organization: DBH Enterprises, Inc. mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-08-11T00:00:00+00:00 List-Id: Hi David, here is a quick and dirty example. Of course, Ada itself has better facilities for printing, than the c-library's printf, but this illustrates some c interfaces. Hoe this helps -- the example even includes pointers ;) with Interfaces.C; with System; with Text_IO; procedure demo_interfaces_c is ada_format_string : constant string := "This is a C format string with a long float" & " format specification %lf" & ascii.LF; function printf ( format_string_address : system.address; long_float_value : long_float ) return integer; pragma interface (C, printf); return_value : integer; c_format_string : Interfaces.C.char_array (0 .. ada_format_string'length); begin c_format_string := Interfaces.C.To_C (ada_format_string); return_value := printf (c_format_string'Address, long_float (3.141592654)); Text_IO.Put_Line ("printf return value =>" & integer'image(return_value)); end demo_interfaces_c; -- David C. Hoos, Sr., http://www.dbhwww.com http://www.ada95.com David Krovich wrote in article ... > > I'm looking for source code examples for using the interfaces.C > package. Any pointers would be appreciated. > > I've already printed out the Interfaces to Other Languages > section from the Ada 95 Reference manual, so please don't just point > me towards that. > > Thanks. > > --------------------------------------------------------------------- > ------David Krovich-----------------------Computer Science Major----- > ----dkrovich@cs.wvu.edu------------------West Virginia University---- > --------------------------------------------------------------------- > > > >