CLinker migration from jdk17 to jdk18

Lev Serebryakov lev at serebryakov.spb.ru
Tue Apr 5 14:23:29 UTC 2022


   I have this code, which works on JDK-17:

         h_native = CLinker.getInstance()
             .downcallHandle(
                 libLookup.lookup("somefunc").get(),
                 MethodType.methodType(
                     MemoryAddress.class,
                     int.class,
                     MemoryAddress.class,
                     MemoryAddress.class,
                     int.class,
                     int.class
                 ),
                 FunctionDescriptor.of(
                     CLinker.C_POINTER,
                     CLinker.C_INT,
                     CLinker.C_POINTER,
                     CLinker.C_POINTER,
                     CLinker.C_INT,
                     CLinker.C_INT
                 )
             );

But it doesn't work on JDK-18 and I don't see proper way to convert it. Is "CLinker.systemCLinker()" replacement for ".getInstance()"? Where are built-in types live now?


BTW. my previous experiments with panama/foreign were long ago, and then there was complex DSL to describe native data structures. Is it gone forever?


Thank you.

-- 
// Black Lion AKA Lev Serebryakov


More information about the panama-dev mailing list