GDExtension: inconsistent relation between GDNativeTypePtr
and Object
#61967
Labels
Milestone
GDNativeTypePtr
and Object
#61967
Godot version
4.0.dev (8df8fff)
System information
Windows 10
Issue description
The variant conversion methods are defined as follows in gdnative_interface.h:
and they map to this C++ code for
Object <-> Variant
conversions:Here we have the equivalence
GDNativeTypePtr == void* == Object**
.In other words, each "type ptr" points to the address of an object, not to an object.
Now let's look at ptrcalls and how the arguments are passed:
with:
So, here we have the equivalence
GDNativeTypePtr == void* == Object*
-- unlike aboveObject**
.This inconsistency makes it quite hard to reason about "type pointers" and "object pointers", as the former mean different things depending on context.
Is there a particular reason for this choice, or do you think it would make sense to unify how
GDNativeTypePtr
andObject
relate?Steps to reproduce
Either of the following will cause a crash -- both are
GDNativeTypePtr
s:Object*
(instead ofObject**
) from the extension binding tovariant_from_type
Object**
(instead ofObject*
)Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: