TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.22k stars 217 forks source link

`UnsafeFunctionPointer::Args` as a convienence. #479

Open JCBurnside opened 4 months ago

JCBurnside commented 4 months ago

Is your feature request related to a problem? Please describe. I am trying to add additional wrapping around engine.get_function to make a jit runtime that would be reusable.

fn get_function<F:UnsafeFunctionPointer>(&self, name:&str, args:...) {
    let function = //gets function
    function.call(args)
}

Describe the solution you'd like Just simply add an associated type that is a tuple of all the args in the UnsafeFunctionPointer

Describe possible drawbacks to your solution I don't see one?

Describe alternatives you've considered essentially cloning the UnsafeFunctionPointer type and adding it myself and making a blanket implementation to map it.

Additional context

JCBurnside commented 4 months ago

Just realized that your call function is also inconsistent with the nightly fn_traits feature see here so not sure what I want is possible with the current api unless an alternate means of calling it as like call_tuple added to JitFunction as well.

TheDan64 commented 3 months ago

I'm not entirely sure if this makes sense to have in inkwell itself, but I'm open to ideas