Avoid `thread_local` on MacOS to prevent issues with hot reload
Fixes https://github.com/godotengine/godot-cpp/issues/1573
~~This isn't quite right yet. I think the lock_guard for reload is in the right place, but the one in Wrapped::_set_construct_info() is wrong. We need to lock around the whole memnew() operation, not just the part where we set those variables. I'm not sure the best way to do that yet.~~
UPDATE: This might be OK now. I need to get a good test.
This depends on PR https://github.com/godotengine/godot-cpp/pull/1590 because it adds another thread_local, and this way we can address that one too
Now that PR https://github.com/godotengine/godot-cpp/pull/1590 is merged, taking this one out of draft!
Cherry-picked for 4.3 in PR https://github.com/godotengine/godot-cpp/pull/1695
FYI, this PR broke my GDExtension code on macOS, causing the following linker errors:
Linking game.dylib
Undefined symbols for architecture arm64:
"thread-local wrapper routine for godot::Wrapped::_constructing_extension_class_name", referenced from:
...
"thread-local wrapper routine for godot::Wrapped::_constructing_class_binding_callbacks", referenced from:
...
ld: symbol(s) not found for architecture arm64
I've resolved the issue for now by passing the option "use_hot_reload=no" to scons when building godot-cpp.
FYI, this PR broke my GDExtension code on macOS, causing the following linker errors:
MacOS builds with hot reload are still working for me. Perhaps doing a scons -c to clean away old build artifacts would help?