indoorvivants / sn-bindgen-examples

Examples of using Scala 3 Native to interop with various C libraries using sn-bindgen
22 stars 2 forks source link

Add JNI #35

Open rintcius opened 1 year ago

rintcius commented 1 year ago

Should be fun :)

I had a quick try but it lead to:

[bindgen] info Struct 'JNIInvokeInterface_' was detected as having cycles
[bindgen] info Struct 'JNIInvokeInterface_' was detected as having cycles
bindgen.rendering.Error: Failed to resolve aliased definition jobjectRefType
        at bindgen.rendering.Error$.apply(Unknown Source)
        at bindgen.rendering.utils$package$AliasResolver$.create$$anonfun$1$$anonfun$1(Unknown Source)
        at bindgen.rendering.utils$package$AliasResolver$.create$$anonfun$1(Unknown Source)
        at bindgen.rendering.struct$package$.given_AliasResolver$lzyINIT1$1$$anonfun$1(Unknown Source)
        at bindgen.rendering.hack_recursive_structs$package$.go$1$$anonfun$2(Unknown Source)
        at bindgen.rendering.hack_recursive_structs$package$.go$1(Unknown Source)
        at scala.collection.mutable.ListBuffer.map(Unknown Source)
        at bindgen.rendering.hack_recursive_structs$package$.hack_recursive_structs(Unknown Source)
        at bindgen.rendering.struct$package$.struct(Unknown Source)
        at bindgen.rendering.binding$package$.binding$$anonfun$2$$anonfun$9(Unknown Source)
        at bindgen.rendering.binding$package$$$Lambda$39.applyVoid(Unknown Source)
        at scala.runtime.function.JProcedure2.apply(Unknown Source)
        at bindgen.rendering.binding$package$.liftedTree1$1(Unknown Source)
        at bindgen.rendering.binding$package$.renderAll$1$$anonfun$1(Unknown Source)
        at bindgen.rendering.binding$package$$$Lambda$26.applyVoid(Unknown Source)
        at scala.runtime.function.JProcedure1.apply(Unknown Source)
        at scala.collection.immutable.List.foreach(Unknown Source)
        at bindgen.rendering.binding$package$.binding$$anonfun$2(Unknown Source)
        at bindgen.rendering.binding$package$$$Lambda$2.applyVoid(Unknown Source)
        at scala.runtime.function.JProcedure1.apply(Unknown Source)
        at bindgen.rendering.binding$package$.binding(Unknown Source)
        at bindgen.Generate$.main$$anonfun$1(Unknown Source)
        at bindgen.Generate$$$Lambda$1.applyVoid(Unknown Source)
        at scala.runtime.function.JProcedure1.apply(Unknown Source)
        at scala.scalanative.unsafe.Zone$.apply(Unknown Source)
        at <none>.main(Unknown Source)
keynmol commented 1 year ago

Hah, this would be a fun one, especially if SN finally gains the ability to build dynamic libraries.

The Failed to resolve aliased definition <..> is the bane of my existence - so far I've only seen it on GTK and the JNI header files - and for the life of me I cannot reproduce it in a smaller environment.