Yes, I believe that sounds like the problem I had back on V5R1.
On rechecking yet again, it looks like the return value was 65K fixed
not varying.
Strangely, the MCH exception only appeared to arise during the handling
of a previous unmonitored program exception (eg substring out of
bounds). The substring exception was the first instruction. Following
that were some 130 procedure calls where the prototype declared a 65k
return value. Since the program died on the first instruction, the
procedures never even got called but obviously had still consumed too
much storage.
I guess when the default handlers kicked in they needed more space than
was available.
After that the activation group seemed pretty screwed cause other
subsequently called unrelated programs continued to crash.
Peter
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Friday, 28 November 2008 2:48 p.m.
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Calling C from RPG: what am I doing wrong?
Nathan Andelin wrote:
Barbara eventually explained that this was an unavoidable
consequence of the code the compiler generates to handle varying
length return values, from which I concluded that such procedures
were potentially a bad practice.
Is this only with "large" return values? What about procedures that
return say a 50 byte description [trimmed]?
desc = codeDesc(code);
The problem is proportional to the size of the return value. Calling a
procedure that returns 50 bytes should not be a problem unless you call
it a zillion times in the same procedure.
The problem isn't particularly related to varying-length return values.
There is some additional automatic storage required for a call to a
procedure returning a value (probably not integer or float return
values, though, unless they are arrays).
Varying-length return values are an issue because it seems like they
should only have to return the actual returned length, but actually they
have to return the prototype-defined length.
As an Amazon Associate we earn from qualifying purchases.