-
Notifications
You must be signed in to change notification settings - Fork 24
FFI: Set up an empty FFI library and add libffi as dependency #356
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…re functionality is added to the library
bjcscat
approved these changes
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise this looks good
bjcscat
suggested changes
Sep 5, 2025
aatxe
approved these changes
Sep 16, 2025
aatxe
added a commit
that referenced
this pull request
Sep 16, 2025
This is the first PR for Lute’s FFI branch, which will eventually hold a stable and feature-complete foreign function interface to be merged into the main branch. I’ve already implemented a rough prototype and have some ideas about how the library might look, but the user-facing API and exposed internals are still open for discussion as I build. This PR includes: * The libffi dependency file and CMake support, which tries to replicate libffi's build system, which is using GNU Autotools, as close as possible. * An empty FFI library, only containing a field for the C interface. For now contains a function which simply adds two numbers to test if libffi is working correctly, will probably be removed soon enough. No real functionality yet, but next up I plan to implement C types as userdata objects, accessible via the FFI library's C interface. Here’s what I have in mind for the API so far: ```luau local ffi = require("@lute/ffi") local ffi_c = ffi.c local int = ffi_c.int local void = ffi_c.void local voidptr = void:ptr() local int_array = int:array(5) local vec3 = ffi_c.struct({ {x = float}, {y = float}, {z = float} }) local add_function = ffi_c.func({int, int}, int) ``` If that API seems reasonable I'll get started on the next PR after this one gets reviewed. --------- Co-authored-by: ariel <[email protected]>
aatxe
added a commit
that referenced
this pull request
Sep 16, 2025
This is the first PR for Lute’s FFI branch, which will eventually hold a stable and feature-complete foreign function interface to be merged into the main branch. I’ve already implemented a rough prototype and have some ideas about how the library might look, but the user-facing API and exposed internals are still open for discussion as I build. This PR includes: * The libffi dependency file and CMake support, which tries to replicate libffi's build system, which is using GNU Autotools, as close as possible. * An empty FFI library, only containing a field for the C interface. For now contains a function which simply adds two numbers to test if libffi is working correctly, will probably be removed soon enough. No real functionality yet, but next up I plan to implement C types as userdata objects, accessible via the FFI library's C interface. Here’s what I have in mind for the API so far: ```luau local ffi = require("@lute/ffi") local ffi_c = ffi.c local int = ffi_c.int local void = ffi_c.void local voidptr = void:ptr() local int_array = int:array(5) local vec3 = ffi_c.struct({ {x = float}, {y = float}, {z = float} }) local add_function = ffi_c.func({int, int}, int) ``` If that API seems reasonable I'll get started on the next PR after this one gets reviewed. --------- Co-authored-by: ariel <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first PR for Lute’s FFI branch, which will eventually hold a stable and feature-complete foreign function interface to be merged into the main branch. I’ve already implemented a rough prototype and have some ideas about how the library might look, but the user-facing API and exposed internals are still open for discussion as I build.
This PR includes:
No real functionality yet, but next up I plan to implement C types as userdata objects, accessible via the FFI library's C interface. Here’s what I have in mind for the API so far:
If that API seems reasonable I'll get started on the next PR after this one gets reviewed.