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

Brian G brian at westwoodsvcs.com
Sun Mar 26 18:07:04 CEST 2023


But when working with structures, Returning a Gambas is really not of any use to anyone. Would it not be more consitant to return the actual address of the structure as it was assigned?

Would this be difficult to acheive?

"Failure is the key to success; 
 each mistake teaches us something"  .. Morihei Ueshiba
Brian G

----- On Mar 26, 2023, at 6:57 AM, Benoit Minisini benoit.minisini at gambas-basic.org wrote:

> 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.
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----


More information about the User mailing list