gm2
[Top][All Lists]
Advanced

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

Interfacing Modula-2 and "C"


From: Michael Riedl
Subject: Interfacing Modula-2 and "C"
Date: Sat, 17 Jun 2023 22:34:50 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

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





reply via email to

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