CLinker migration from jdk17 to jdk18

Lev Serebryakov lev at serebryakov.spb.ru
Tue Apr 5 15:08:43 UTC 2022


On 05.04.2022 17:32, Maurizio Cimadamore wrote:

  BTW, I get "java.lang.invoke.WrongMethodTypeException" when call invokeExact() resulting handle on JDK18/Windows.

  Previous code works well on JDK17.

> So, in short, your example will become something like:
> 
> ```
> h_native = CLinker.systemCLinker()
>              .downcallHandle(
>                  libLookup.lookup("somefunc").get(),
>                  FunctionDescriptor.of(
>                      ValueLayout.ADDRESS,
>                      ValueLayout.JAVA_INT,
>                      ValueLayout.ADDRESS,
>                      ValueLayout.ADDRESS,
>                      ValueLayout.JAVA_INT,
>                      ValueLayout.JAVA_INT
>                  )
>              );
> ```
> 
> (the above assumes LP64 - e.g. where a C int is 32 bits).

-- 
// Black Lion AKA Lev Serebryakov


More information about the panama-dev mailing list