fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: VO conversion - PTR issue

VO conversion - PTR issue 1 year 4 months ago #1

  • boonnam
  • boonnam's Avatar Topic Author
  • Offline
  • Posts: 34
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

Please Log in or Create an account to join the conversation.

VO conversion - PTR issue 1 year 4 months ago #2

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:
METHOD AgtStmtHdr(iPage REF USUAL, nPageCnt REF USUAL, dVdate AS USUAL, lFinal AS USUAL)

Or use more correct types, such as INT, INT, DATE and LOGIC

And in the calling code:
SELF:AgtStmtHdr(@page,@nPageCnt,dVdate,lFinal)
This requires compiler option /vo7 (Implicit Casts And Conversions)

or better (since it documents what you are doing)
SELF:AgtStmtHdr(REF page, REF nPageCnt,dVdate,lFinal)
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
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1