Skip to content

[FFI] Accept const arguments in TVMFFIFunctionCall - #978

Open
miyanyan wants to merge 1 commit into
apache:mainfrom
miyanyan:const-function-call-args
Open

miyanyan wants to merge 1 commit into
apache:mainfrom
miyanyan:const-function-call-args

Conversation

@miyanyan

Copy link
Copy Markdown
Contributor

I found TVMFFIFunctionCall input args is not const, but marked as const in rust

pub fn TVMFFIFunctionCall(
func: TVMFFIObjectHandle,
args: *const TVMFFIAny,
num_args: i32,
result: *mut TVMFFIAny,
) -> i32;

and TVMFFIFunctionCall already forwards args unchanged to its safe_call callback, which takes const TVMFFIAny*.

so there seems missing the const qualifier.

Match the read-only input array accepted by the safe_call callback. Callers can forward const packed arguments directly. Code declaring the entry point through an explicit function pointer should update its parameter type.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant