-
-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.4.2] register_method does not accept arguments passed by reference #697
Comments
@Calinou I rephrase my sentence because it was not very understandable. |
@Calinou Maybe a patch could be in godot-cpp/include/core/Godot.hpp (godot 3.4.2) where the current code is:
To add this:
I have no more warning, but I very unsure if this is the good solution since in my opinion this will make an extra copy that we do not want. PS: why not these methods are not constexpr this could help avoiding making copies ? |
In contrast, GDExtension in 4.0 can mandate C++17 support since Godot 4.0 itself requires a C++ compiler to be built. |
That makes sense |
Let suppose a member method like this:
If we want to make it uses for GDNative script, we have to export it:
This makes pass the string by copy and this works fine ! But now let pass
name
by reference:But this reference will produce a warning:
And possibly gives a crash. So How to deal: passing C++ reference with register_method ?
PS: register_method and C++ references worked well within Godot modules (C++ code inside the Godot editor code source inside the modules/ folder). I had no warnings.
The text was updated successfully, but these errors were encountered: