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,4d1e35c40963653d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-12 08:31:49 PST Path: archiver1.google.com!news2.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!spamfinder.gnilink.net!typhoon1.gnilink.net.POSTED!not-for-mail Message-ID: <3B76D0DB.313A0821@mail.verizon.net> From: Jack Scheible Reply-To: vze26j9s@verizon.net X-Mailer: Mozilla 4.5 [en]C-CCK-MCD BA45DSL (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Trying to pass strings to Fortan routines References: <3B765238.6F013AD3@mail.verizon.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 12 Aug 2001 15:28:38 GMT NNTP-Posting-Host: 138.88.63.31 X-Complaints-To: business-support@verizon.com X-Trace: typhoon1.gnilink.net 997630118 138.88.63.31 (Sun, 12 Aug 2001 11:28:38 EDT) NNTP-Posting-Date: Sun, 12 Aug 2001 11:28:38 EDT Xref: archiver1.google.com comp.lang.ada:11816 Date: 2001-08-12T15:28:38+00:00 List-Id: Hideous, but it works. I don't like having to call a Fortran subroutine as though it were C, but it works. Thanks. -jack tmoran@acm.org wrote: > > int main(){ > > char filename[] = "test.out"; > > char str[] = "Testing..."; > > print_( filename, str, strlen(filename), strlen(str) ); > > } > > Try: > > with Interfaces.C; > procedure Main is > > procedure C_Print(Filename, Str : access Interfaces.C.Char; > Filename_Length, Str_Length: in Interfaces.C.Size_T); > pragma Import(C, C_Print, "print_"); > > procedure Print(Filename, Str : in String) is > C_Filename: Interfaces.C.Char_Array := Interfaces.C.To_C(Filename); > C_Str : Interfaces.C.Char_Array := Interfaces.C.To_C(Str); > begin > C_Print(C_Filename(0)'Unchecked_Access, C_Str(0)'Unchecked_Access, > Interfaces.C.Size_T(Filename'Length), Interfaces.C.Size_T(Str'Length)); > end Print; > > begin > Print("test.out", "Testing..."); > end Main;