[Gambas-bugtracker] Bug #2261: EXTERN function call does not work with Struct ?

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Mon Jun 14 23:32:11 CEST 2021


http://gambaswiki.org/bugtracker/edit?object=BUG.2261&from=L21haW4-

Comment #6 by Benoît MINISINI:

Not necessarily. VarPtr() on an embedded variable gives you a pointer on the first byte of the data. Then it's a matter of pointer arithmetic.

Of course, if you search the address of a deeply imbricated field of a structure, it starts to be complex.

Now that SizeOf() can return the size of a structure, it's at least easy to get the address of the n-th element of an embedded array of structure.

If you have an object reference, Object.Address() will return a pointer on the object allocation. The data is two pointers after (look at the source code of the interpreter to see the associated structure). But I suggest not base your code on that, it may change in the future.




More information about the Bugtracker mailing list