Repository navigation
Conversation
This is a preparation for supporting structs passed by value (ruby#114). `Fiddle::Function` resolves each argument type and the return type from an `int` to an `ffi_type *` when it prepares the CIF. An `int` can only represent built-in types, so a struct type can't be passed to `ffi_prep_cif()` this way. `#initialize` resolves the types once and keeps them in the new `argument_ffi_types` and `return_ffi_type` members. `#call` copies the fixed argument types from `argument_ffi_types` and resolves only the variadic argument types. This doesn't change behavior. The CIF is still prepared lazily on the first `#call`, and `cif.arg_types` is still allocated and owned by the CIF as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
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 a preparation for supporting structs passed by value (#114).
Fiddle::Functionresolves each argument type and the return type from anintto anffi_type *when it prepares the CIF. Anintcan only represent built-in types, so a struct type can't be passed toffi_prep_cif()this way.#initializeresolves the types once and keeps them in the newargument_ffi_typesandreturn_ffi_typemembers.#callcopies the fixed argument types fromargument_ffi_typesand resolves only the variadic argument types.This doesn't change behavior. The CIF is still prepared lazily on the first
#call, andcif.arg_typesis still allocated and owned by the CIF as before.