[Gambas-user] Object.address() returns wrong address for a structure

Benoit Minisini benoit.minisini at gambas-basic.org
Sun Mar 26 08:57:25 CEST 2023


Le 26/03/2023 à 05:09, Brian G a écrit :
> When getting the address for a structure object the wrong address is 
> returned. It looks like the address returned is a control block of some 
> sort.
> object.sizeof() does return the correct length for the structure.
> 
> I thought it would return the same address as was assigned to it.
> 
> dim a as pointer = alloc(1000,1)
> dim b as MyStruct
> b = a
> then
> object.address(b) should equal a
> 
> But instead it seems to return some sort of control block, but I 
> expected for a structure to just recieve the same address as was assigned.
> 
> If this is correct, then is there a way to get the assigned address for 
> a structure object?
> 
> "Failure is the key to success;
>   each mistake teaches us something"  .. Morihei Ueshiba
> Brian G
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Object.Address() returns the address of a Gambas in memory, not the 
address of the data it references.

There is no function at the moment that does what you want.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list