[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C
From: |
Rudolf Schubert |
Subject: |
Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C |
Date: |
Sun, 28 Jan 2024 14:02:40 +0100 (CET) |
High Gaius,
I'm facing a problem when trying to pass a parameter of typ String256
to C, which I've defined like this:
CONST
len256= 256;
TYPE
String256= ARRAY[0..len256-1] OF CHAR;
In the appended example I've set up three DEFINITION MODULEs
(unix1.def, unix2.def, unix3.def) each with a corresponding
C file (unix1.c, unix2.c, unix3.c). There is only one simple
function in these C files which should print out the length
of the passed string and the string proper.
unix1.def does NOT have 'FOR "C"' whereas unix2.def and unix3.def
do have a 'FOR "C"' in the MODULE definition. In unix1.def and unix2.def
the PROCEDURE ParamTest has got (my_str: String256) but in unix3.def
I'm using 'varargs' (...).
I'm seeing that only unix3 does give the expected results. unix1 and
unix2 do either crash the programm or return wrong results.
I do observe similar behaviour not only for
type 'ARRAY[0..MAXINDEX] OF CHAR'
but for instance also for
type 'ARRAY[0..MAXINDEX] OF CARDINAL'
Now my question is: how would I pass parameters of this type to
C functions? I would suspect that this should not only work for
'varargs' but also in the other cases? When using open ARRAYs in
the PROCEDURE things are also working fine. It's just when using
'non open' ARRAYs that the problem occurs.
BR
Rudolf
--
Rudolf Schubert \
Kirchstr. 18a \ mailto:rudolf@muc.de
82054 Sauerlach > http://www.dose.muc.de
Deutschland / (alpine archkiste)
Tel. 08104/908311 /
wrk_gm2_16.tgz
Description: application/gzip
- Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C,
Rudolf Schubert <=
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Benjamin Kowarsch, 2024/01/28
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Rudolf Schubert, 2024/01/28
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Benjamin Kowarsch, 2024/01/28
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Gaius Mulley, 2024/01/30
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Benjamin Kowarsch, 2024/01/30
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Gaius Mulley, 2024/01/30
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Gaius Mulley, 2024/01/30
- Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Michael Riedl, 2024/01/29
Re: Passing parameters of type 'ARRAY[0..MAXINDEX] OF ElementType' to C, Gaius Mulley, 2024/01/29