godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Improve logging around method binding

Open bitbrain opened this issue 3 years ago • 3 comments

The current output is not very helpful because it does not tell which method is affected. Including the method name actually helps identify the method.

bitbrain avatar Aug 12 '22 18:08 bitbrain

After testing this it looks like this does not quite work:

> [0] std::_Atomic_storage<unsigned int,4>::load (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\atomic:912)
[1] std::_Atomic_storage<unsigned int,4>::load (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\atomic:912)
[2] SafeNumeric<unsigned int>::conditional_increment (C:\Users\Miguel\Documents\godot\core\templates\safe_refcount.h:123)
[3] CowData<char32_t>::_ref (C:\Users\Miguel\Documents\godot\core\templates\cowdata.h:407)
[4] String::String (C:\Users\Miguel\Documents\godot\core\string\ustring.h:449)
[5] PtrToArg<String>::convert (C:\Users\Miguel\Documents\godot\core\variant\method_ptrcall.h:121)
[6] OperatorEvaluatorAdd<String,String,String>::ptr_evaluate (C:\Users\Miguel\Documents\godot\core\variant\variant_op.h:53)
[7] godot::internal::_call_builtin_operator_ptr<godot::String> (C:\Users\Miguel\git\fmod-project\fmod-gdnative\godot-cpp\include\godot_cpp\core\builtin_ptrcall.hpp:66)
[8] godot::String::operator+ (C:\Users\Miguel\git\fmod-project\fmod-gdnative\godot-cpp\gen\src\variant\string.cpp:794)
[9] godot::operator+ (C:\Users\Miguel\git\fmod-project\fmod-gdnative\godot-cpp\src\variant\char_string.cpp:379)
[10] godot::ClassDB::bind_methodfi (C:\Users\Miguel\git\fmod-project\fmod-gdnative\godot-cpp\src\core\class_db.cpp:158)

bitbrain avatar Aug 12 '22 18:08 bitbrain

Probably should use generic c-strings (sprinf), instead of String. But it's a good thing to have.

bruvzg avatar Aug 31 '22 10:08 bruvzg

since String callback are not inited

@bruvzg could you elaborate on this? I am not a C++ expert (coming from Java world) and still learning all these things.

bitbrain avatar Sep 01 '22 11:09 bitbrain

It looks like this aims to solve the same problem as PR https://github.com/godotengine/godot-cpp/pull/654

The version there uses sprintf().

I guess it's not working with MSVC since String callback are not inited.

I'm kind of surprised by this. I would have thought String would be ready by the time that any user classes are registering methods. I think this probably deserves a 2nd look, in case it's working now or there's some change we could make that would allow String (or really vformat() which uses String internally) to be used here.

dsnopek avatar Nov 17 '23 19:11 dsnopek

I am happy for this to be closed but #654 probably needs some other nudge by @BastiaanOlij (I see Remi left some comments there)

bitbrain avatar Nov 17 '23 20:11 bitbrain