AddressMBS returns a ptr, so please use a ptr variable for the result.
Than you can assign to a memoryblock variable which triggers the automatically conversion.
this code works:
[code]dim m as new MemoryBlock(10)
dim p as ptr = m.AddressPtrMBS(0)
dim o as MemoryBlock = p
sorry, you did it other way. So you have p which is a ptr and call AddressPtrMBS on this. But AddressPtrMBS requires to be called on a memoryblock.
So first assign to memoryblock, than query new ptr:
[code] dim p as ptr, offset as integer
dim mb as memoryblock
dim temp as MemoryBlock = p
mb = temp.AddressPtrMBS(offset)[/code]
Thanks, Christian. I’m interested in why this change was made, as it seems to break code that is otherwise sensible, and the workaround looks somewhat clumsy.
On a side note, is this something you could fix within the plugin? e.g. have overloaded versions of AddressPtrMBS that handle memoryBlock and Ptr ?
Thanks, Joe. I ran into another situation that’s similar, but different:
dim v as variant = "600x400"
dim w as integer
w = val(v.NthField("x",1))
Which also triggers the “requires a conversion… use CType” message
In this case, I fixed it using .StringValue:
dim v as variant = "600x400"
dim w as integer
w = val(v.StringValue.NthField("x",1))
I guess my overall question here : Is this fixing a bug or some edge case that wouldn’t compile or execute properly? Or is it more just a change in the compiler rules that had to happen for some other reason, but doesn’t really fix anything broken in these particular examples? Or…?