Skip to content
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

Implement new StableApiDefinition struct methods #448

Open
ianks opened this issue Nov 21, 2024 · 0 comments · May be fixed by #467
Open

Implement new StableApiDefinition struct methods #448

ianks opened this issue Nov 21, 2024 · 0 comments · May be fixed by #467
Assignees
Labels

Comments

@ianks
Copy link
Collaborator

ianks commented Nov 21, 2024

In order to support Truffleruby on magnus, we need to support struct operations, which currently relies on cruby internals.

/// Defines a struct type with the given name and members.
///
/// # Example
/// 
fn rstruct_define(&self, name: &CStr, members: &[&CStr]);

/// Accesses an indexed member of the struct.
///
/// # Safety
/// This function is unsafe because it dereferences a raw pointer to get
/// access to underlying struct data. The caller must ensure that the
/// `VALUE` is a valid pointer to a struct.
unsafe fn rstruct_get(&self, st: VALUE, idx: c_int) -> VALUE;

/// Sets an indexed member of the struct.
///
/// # Safety
/// This function is unsafe because it dereferences a raw pointer to get
/// access to underlying struct data. The caller must ensure that the
/// `VALUE` is a valid pointer to a struct.
unsafe fn rstruct_set(&self, st: VALUE, idx: c_int, value: VALUE);

/// Returns the number of struct members.
///
/// # Safety
/// This function is unsafe because it dereferences a raw pointer to get
/// access to underlying struct data. The caller must ensure that the
/// `VALUE` is a valid pointer to an RStruct.
unsafe fn rstruct_len(&self, obj: VALUE) -> c_long;
@ianks ianks added this to the Full Truffleruby Support milestone Nov 21, 2024
@ianks ianks changed the title Implement new StableApi struct methods Implement new StableApiDefinition struct methods Nov 21, 2024
@ianks ianks added the help wanted Extra attention is needed label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants