I'm testing our converted VO application. It is using VO dialect, and I am on v1.03.
Here is an example method:
METHOD AgtStmtHdr(iPage, nPageCnt, dVdate, lFinal)
.
.
.
.
IF iPage != 0
.
.
ELSE
.
.
ENDIF
iPage++
.
.
.
.
RETURN
A calling method look something like this:
METHOD Execute()
LOCAL page as INT
.
.
.
page := 0
SELF:AgtStmtHdr(@page,@nPageCnt,dVdate,lFinal)
.
.
.
RETURN
When I run it, it would crashed on line, "IF iPage != 0". The error is "Value does not fall within the expected range". In VO iPage (inside AgtStmtHdr) is 0, but while debugging in X#, I see a big number like 19745096 (PTR), but if I expand it, I see something like 0x01a781c for the "value".
My focus is to fix issue with iPage. The same fix would apply to nPageCnt.
I resolved one small class with same issue by creating a protected variable for the page and use it, instead of passing it as a parameter.
Anyone run into similar issue and what is the best way to correct it? Is there a way to correct the codes inside AgtSmtHdr method? I'm trying to minimize the amount of changes as much as possible.
Thanks,
Boonnam
VO conversion - PTR issue
VO conversion - PTR issue
Boonnam,
What you are doing in this code is passing USUAL values by reference.
The Vulcan runtime does not support this.
If you control this code, then I would advise to change it a little bit:
Or use more correct types, such as INT, INT, DATE and LOGIC
And in the calling code:
This requires compiler option /vo7 (Implicit Casts And Conversions)
or better (since it documents what you are doing)
This will also compile without /vo7
In VO REF variables and the addressof operator (@) are mixed. In most languages these are 2 completely different things.
Robert
What you are doing in this code is passing USUAL values by reference.
The Vulcan runtime does not support this.
If you control this code, then I would advise to change it a little bit:
Code: Select all
METHOD AgtStmtHdr(iPage REF USUAL, nPageCnt REF USUAL, dVdate AS USUAL, lFinal AS USUAL)
And in the calling code:
Code: Select all
SELF:AgtStmtHdr(@page,@nPageCnt,dVdate,lFinal)
or better (since it documents what you are doing)
Code: Select all
SELF:AgtStmtHdr(REF page, REF nPageCnt,dVdate,lFinal)
In VO REF variables and the addressof operator (@) are mixed. In most languages these are 2 completely different things.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu