-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
https://sn-bindgen-web.indoorvivants.com/binding/4974b0bb-4a5a-4b0d-9597-86b9774f2fd0
typedef void (FunctionWithLotsOfParameters)(int a,
int b, int c, int d, int e, int f, int g, int h,
int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t,
int u, int v, int w, int x, int y, int z);package my_bindings
import _root_.scala.scalanative.unsafe.*
import _root_.scala.scalanative.unsigned.*
import _root_.scala.scalanative.libc.*
import _root_.scala.scalanative.*
object aliases:
import _root_.my_bindings.aliases.*
type FunctionWithLotsOfParameters = CFuncPtr26[CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, Unit]
object FunctionWithLotsOfParameters:
given _tag: Tag[FunctionWithLotsOfParameters] = Tag.materializeCFuncPtr26[CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, Unit]
inline def apply(inline o: CFuncPtr26[CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, Unit]): FunctionWithLotsOfParameters = o
extension (v: FunctionWithLotsOfParameters)
inline def value: CFuncPtr26[CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, CInt, Unit] = v
object types:
export _root_.my_bindings.aliases.*
object all:
export _root_.my_bindings.aliases.FunctionWithLotsOfParameters
This of course is not possible (CFuncPtr22 is the maximum)
The issue here is that at this point I don't know how to even represent this in Scala.
One idea is
- A hidden struct with same number of parameters
- The function type is itself an opaque pointer Ptr[Byte] (e.g.
opaque type FunctionWithLotsOfParameters = Ptr[Byte] - A
apply(...)extension onFunctionWithLotsOfParameterswhich takes all the parameters, packs them into a stack allocated struct, then invokes - a glue C function that unpacks the struct into individual parameters, and invokes the original
FunctionWithLotsOfParameters
The overhead on this puppy is going to be severe.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels