gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] Calling C functions


From: Gaius Mulley
Subject: Re: [Gm2] Calling C functions
Date: Mon, 26 Nov 2012 10:02:37 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

john o goyo <address@hidden> writes:

> The info page (Para. 2.14) states:
>
> For example unbounded arrays are
> passed as a `struct {void *address, unsigned int high}' and the
> contents of these arrays are copied by callee functions when they are
> declared as non `VAR' parameters.
>
> Here is an example which can be found in the source tree
> `gcc-VERSION-GCC/gcc/gm2/examples/callingC/libprintf.def'
>
>      DEFINITION MODULE FOR "C" libprintf ;
>
>      EXPORT UNQUALIFIED printf ;
>
>      PROCEDURE printf (a: ARRAY OF CHAR; ...) : [ INTEGER ] ;
>
>      END libprintf.
>
>
> These cannot both be correct as printf() knows nothing about the
> structure
> in the first paragraph.  What happens to the HIGH value.
>
> jog

Hi John,

true, the definition for C treats the ARRAY OF type parameters differently.

http://www.nongnu.org/gm2/interface_to_c.html

in the case of ARRAY OF CHAR as char * (no high is passed),

regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]