[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interfacing Modula-2 and "C"
From: |
Gaius Mulley |
Subject: |
Re: Interfacing Modula-2 and "C" |
Date: |
Sat, 17 Jun 2023 22:18:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Michael Riedl <udo-michael.riedl@t-online.de> writes:
> Gaius,
>
> I need a little support.
>
> If I define a procedure, e.g.
>
> PROCEDURE MatrixOperation(VAR A : ARRAY OF ARRAY OF REAL;
>
> M,N : CARDINAL);
>
> and want to actually implement the routine in "C" without using a
> definition module of the form "DEFINITION MODULE FOR "C" xyz", then I
> can define the "C" counterpart as
>
> void MatrixOperation(double *A,
>
> unsigned int high2,
>
> unsigned int high1,
>
> unsigned int M,
>
> unsigned int N)
>
> or with
>
> struct MATRIX {
> double *Adr;
> unsigned int high2;
> unsigned int high1;
> };
>
> void MatrixOperation(struct MATRIX A,
> unsigned int M, unsigned int N)
>
> Which one is the correct form ? The documentation would indicate the
> struct form, but not 100 % sure. Essential is that I can safely
> evaluate the high value(s) to do some checks.
>
> Thanks in advance
>
> Michael
Hi Michael,
yes the struct form is correct:
void MatrixOperation (struct MATRIX A,
unsigned int M, unsigned int N)
struct MATRIX { double *_m2_contents;
unsigned int _m2_high_1;
unsigned int _m2_high_2; };
hope this helps,
regards,
Gaius