-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
[WIP] Implement FFI for GDScript. #85741
base: master
Are you sure you want to change the base?
Conversation
This is interesting. I had an idea like this for quite some time but never got around to implementing something. |
I haven't looked at the code, but conceptually I think this is a great idea! Integrating with 3rd party libraries today requires using GDExtension, but this would provide an alternative GDScript-only path to do it. |
This is interesting in particular for people who've had to use C# builds of Godot in the past just to be able to use its Invoke functionality, which calls into native libraries. |
c554e43
to
8b9c9c0
Compare
5dc6eb2
to
fc6839e
Compare
Neat, missed this so far and will have a look later. IMO important concern: It might be reasonable to disable this functionality by default in the editor (and editor started projects; similar to how you have to enable/opt-in addons), simply because it could allow malicious code to do all kind of nasty stuff default tool scripts can't do. Maybe decoupling this here, could be worth having a "Do you trust this source?" kind of banner once certain function calls or classes are used in a project? |
GDScript can download and run executable or load GDExtension (which can have arbitrary native code) so FFI won't make it more insecure than it already is. |
Hm, true. |
|
What's the status on this PR? Would love to potentially try to rebase and get a bit more into this feature over the Holidays, as there's sadly not too much activity here. |
Needs testing on various platforms and architectures, it works fine on arm64 and x86-64, but extremely buggy on 32-bit x86, and not tested on any other architectures. |
Implement simple FFI for the GDScript using
libffi
.FFILibrary
class.PackedByteArray
and copy data from a pointer to aPackedByteArray
.Array
.Simple demo - Click to expand
Tested (with the aforementioned demo only) on:
TODO: