and3rson / foreigner

FFI library for Godot, built with GDNative
MIT License
25 stars 4 forks source link

Make use of existing Godot dynamic library loading functionality? #8

Open follower opened 4 years ago

follower commented 4 years ago

Re: src/crossplatform.cpp

Existing Godot dynamic library loading functionality

At some point I discovered that Godot already has abstracted/cross-platform dynamic library loading & symbol lookup functionality (including special handling for iOS exports), declared virtual here:

And implemented per platform, e.g.:

Related commits: here & here.

No access via GDNative

Unfortunately this functionality isn't exposed via GDNative--it's unclear if this is intentional or merely a result of the methods being virtual.

Rather than re-implement the wheel, it seems like it would be good to make use of the existing functionality, by e.g. doing one of:

Related: call_native()

Semi-related would be that potentially we might also then piggyback on top of the existing GDNative::call_native() functionality:

Conclusion

Primarily this issue is to point out "hey this exists" but might also show potential approaches for integration of FFI functionality into Godot more directly.

Edits: Added commit links. Add src/crossplatform.cpp link.