I have the following line of code that gives me a compiler error:
Code: Select all
SELF:oOLEObject := OBJECT( _CAST, PCALLNATIVE<INT>( ptrFunc, PSZ( pcVersion)))
Is this because PCallNative is not supported yet or is there another problem?
Mathias
Code: Select all
SELF:oOLEObject := OBJECT( _CAST, PCALLNATIVE<INT>( ptrFunc, PSZ( pcVersion)))
Code: Select all
nResult := PCALLNATIVE<INT>( ptrFunc, PSZ( pcVersion))
SELF:oOLEObject := OBJECT( _CAST, nResult)
Code: Select all
LOCAL i := 67 AS INT
LOCAL o1 AS OBJECT
LOCAL o2 AS OBJECT
o1 := (OBJECT)i
o2 := OBJECT(_CAST, i)
In this specific code sample, it would had been safe to do such a cast, but this is code written specifically for .Net (X# or vulcan), it's not code that would compile in VO. When there is such a cast in VO, it is almost always used to convert an int, holding a pointer to an object to a var holding a reference to that object itself (like in your original code with the OLE object). This did work in VO (Win32 apps in general), but it is completely not allowed in .Net, it will never work like that.Kromi wrote:Casting an int to an object should not be a problem, I guess.
Check this code. First assignment compiles, the second not. Aren't they equivalent?
Code: Select all
LOCAL i := 67 AS INT LOCAL o1 AS OBJECT LOCAL o2 AS OBJECT o1 := (OBJECT)i o2 := OBJECT(_CAST, i)