Open PierceLBrooks opened 1 year ago
Context: gen/src/variant/utility_functions.cpp:708
Variant UtilityFunctions::min_internal(const Variant **p_args, GDExtensionInt p_arg_count) {
static GDExtensionPtrUtilityFunction _gde_function = internal::gdextension_interface_variant_get_ptr_utility_function(StringName("min")._native_ptr(), 3896050336);
CHECK_METHOD_BIND_RET(_gde_function, Variant());
Variant ret;
_gde_function(&ret, reinterpret_cast<GDExtensionConstVariantPtr *>(p_args), p_arg_count);
return ret;
}
_gde_function
is GDExtensionPtrUtilityFunction
gdextension_interface.h:212
typedef void (*GDExtensionPtrUtilityFunction)(GDExtensionTypePtr r_return, const GDExtensionConstTypePtr *p_args, int p_argument_count);
This int p_argument_count
is an int
. and p_arg_count
is a GDExtensionInt
aka int64_t
going into godotengine code https://github.com/search?q=repo%3Agodotengine%2Fgodot%20GDExtensionPtrUtilityFunction&type=code
There is nothing interesting in git blame on either
godot/core/extension/gdextension_interface.h:212
or the definiton of typedef int64_t GDExtensionInt;
on line 175 of the same file.
Appears to be a typo but I'm not really experienced with the details of how all this fits together, and I've been burned in the past thinking something is simple when it's not.
Since this is the C interface from the engine, I don't think you can correct it in gdextension.
There appears to be other int's in that header too.
Since this is the C interface from the engine, I don't think you can correct it in gdextension.
Yes, this would need to be changed in Godot first. And, unfortunately, for binary compatibility we can't just change GDExtensionPtrUtilityFunction
, we'd need to add a new GDExtensionPtrUtilityFunction2
(with a 2
at the end) with the new signature.
This probably should be fixed in Godot, because ideally we'd be using GDExtensionInt
for all integers, to avoid any compiler or platform-specific quirks.
However, as a workaround, I think we could change the way we generate code for utility_funcitons.hpp/cpp
in godot-cpp to use int
rather than GDExtensionInt
?
Is there any mechanism for adding breaking Changes into godot that wait for a major release cycle?
On Thu, Sep 26, 2024, 10:47 PM David Snopek @.***> wrote:
Since this is the C interface from the engine, I don't think you can correct it in gdextension.
Yes, this would need to be changed in Godot first. And, unfortunately, for binary compatibility we can't just change GDExtensionPtrUtilityFunction, we'd need to add a new GDExtensionPtrUtilityFunction2 (with a 2 at the end) with the new signature.
This probably should be fixed in Godot, because ideally we'd be using GDExtensionInt for all integers, to avoid any compiler or platform-specific quirks.
However, as a workaround, I think we could change the way we generate code for utility_funcitons.hpp/cpp in godot-cpp to use int rather than GDExtensionInt?
— Reply to this email directly, view it on GitHub https://github.com/godotengine/godot-cpp/issues/1080#issuecomment-2376949093, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANEDDWP6PCERYOZU4LGBKDZYQCOLAVCNFSM6AAAAABOXOBBVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZWHE2DSMBZGM . You are receiving this because you commented.Message ID: @.***>
No, not yet. :-) We're all still recovering from the Godot 3 -> 4 transition, and so planning for how to handle the next major version release hasn't started. We're trying to include as much as we can into Godot 4 in a compatible way, which is definitely possible in this case, it'd just be a lot of effort for a very minor change.
In the short-term, I think updating the code generation to get rid of the compiler warning/error is probably the way to go.
Or, actually, another possibility is replacing the int
s in gdextension_interface.h
with int32_t
? It's probably the same everywhere, and so we don't break compatibility - it'd be more of a "clarification" than a change. We'd still need to update the code generation in godot-cpp, though.
This can be reproduced with the following project... https://github.com/PierceLBrooks/gdextensions
Also, here is an error message log dump sample showing details of the problem that are repeated times due template interactions upon build failure.