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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Making the same mistake as the broken C interface to fortran Date: Fri, 05 Jul 2019 18:44:56 +0100 Organization: A noiseless patient Spider Message-ID: References: <2uYSE.298383$sJ3.119314@fx04.am4> <499TE.1270744$Ud5.547915@fx12.am4> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="10ed4affddd6013227703b6b1927c802"; logging-data="19621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CC9uo5otkpKWhSy7Vq6BanuVgR3G+wjQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:rSkueHWvuJb8IioD2lOJW92SZrQ= sha1:a/4578iWcMXbc8chYSk6bJ6LIyQ= Xref: reader01.eternal-september.org comp.lang.ada:56823 Date: 2019-07-05T18:44:56+01:00 List-Id: Chris M Moore writes: > On 04/07/2019 09:38, Simon Wright wrote: >> procedure Call is >> procedure Callee_C (C : Character) >> with >> Import, >> Convention => Fortran, >> External_Name => "callee_"; >> procedure Callee_F (C : Interfaces.Fortran.Fortran_Character) >> with >> Import, >> Convention => Fortran, >> External_Name => "callee_"; >> procedure Callee_S (S : String) >> with >> Import, >> Convention => Fortran, >> External_Name => "callee_"; >> begin >> Callee_C ('c'); > > I've looked at the assembler for this. Passing 'c' results in only a > byte pushed to the stack. And then (aha!) the address on the stack is > placed in the rdi register. Because all Fortran parameters are passed by reference.