-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
FontVariation conflict #86533
Comments
This is an issue regarding a third party tool with no namespacing, I don't think we can cover every single third party thing not bundled with Godot, nor can we rename this or move it into a namespace, this is largely IMO a WebKit issue as it is a library, and should provide namespaces to prevent this exact kind of thing |
@AThousandShips Do you know a workaround? |
I don't know any, I don't know Objective-C, and my bad I had missed the part about namespacing there This however is really not for this channel, I'd suggest asking in the other community channels But Godot is an application and not a library, so namespaces aren't necessarily expected or useful, unfortunately this messes with the Objective-C implementation So I'd suggest asking elsewhere as nothing here is necessarily an issue with the engine, nor could it be resolved without major reworks of the engine which isn't really feasible for this kind of issue Thank you for your report and good luck with finding a solution, but closing this as there's nothing actionable here (as applying namespaces to Godot is out of the question, but you could open a proposal for it just to see) Edit: you could also look into doing this as an extension via godot-cpp, which does use namespaces as it is a library in that sense |
You can disable conflicting header. #include "webkitdemo.h"
#define __APPLICATIONSERVICES__
#include <CoreGraphics/CoreGraphics.h>
#include <WebKit/WebKit.h> In general, you can always make a wrapper class to avoid including both headers. |
Ohh... It means that we need to wrap every class of WebKit except FontVariation. Using godot-cpp looks easier. Do someone has a PoC of the WebKit inside GDextension? Especially how to use Objective-C code inside the extension? |
A super hacky workaround that will probably work is redefining WebKit's FontVariation to another symbol (in this example "_FontVariation") by using a macro: #define FontVariation _FontVariation
#include <WebKit/WebKit.h>
#undef FontVariation After the redefinition, if you ever need to use it, refer to _FontVariation instead of FontVariation. |
Tested versions
4.2.stable
System information
MacOS 14.1.2 - Godot v4.2.stable
Issue description
If we are using Godot Control and WebKit together we get error
Maybe we should provide some way to avoid this type of errors?
Steps to reproduce
Use WebKit with Godot Control.
We also can't wrap
include <WebKit/WebKit.h>
to a namespace because oferror: Objective-C declarations may only appear in global scope
Minimal reproduction project (MRP)
webkitdemo.zip
Put it in the modules folder and run
See webkit_demo.mm file
The text was updated successfully, but these errors were encountered: