Just starting out? Need help? Post your questions and find answers here.
-
Mistrel
- Addict
- Posts: 3415
- Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel »
Would someone please explain why this doesn't work?
Code: Select all
Interface TestObject
ProcA()
EndInterface
Procedure ProcA()
Debug "Hello!"
EndProcedure
a.TestObject=?VTABLE
;/ [ERROR] Invalid memory access. (Read error at address 18446744073709551615)
a\ProcA()
DataSection
VTABLE:
Data.i @ProcA()
EndDataSection
-
Mistrel
- Addict
- Posts: 3415
- Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel »
To answer my own question, it has to be written like this:
Code: Select all
Interface TestObject
ProcA()
EndInterface
Procedure ProcA()
Debug "Hello!"
EndProcedure
b=?VTABLE
a.TestObject=@b
a\ProcA()
DataSection
VTABLE:
Data.i @ProcA()
EndDataSection
-
NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
-
Contact:
Post
by NicTheQuick »
No, this is also not correct. The procedure ProcA() has to have at least one parameter in its definition but not in its interface.
Code: Select all
Interface TestObject
ProcA()
EndInterface
Structure TestObjectData
*vTable
value.i
EndStructure
Procedure ProcA(*this.TestObjectData)
Debug "The value is " + *this\value
EndProcedure
Define aData.TestObjectData, a.TestObject = aData
aData\vTable = ?VTABLE
aData\value = 123
a\ProcA()
DataSection
VTABLE:
Data.i @ProcA()
EndDataSection
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.