[foreign-jextract] RFR: 8244959: Jextract's VarargsInvoker fails to link functions when passing integer types other than long

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu May 14 09:57:27 UTC 2020

On Wed, 13 May 2020 21:49:13 GMT, Henry Jen <henryjen at openjdk.org> wrote:

> This PR makes sure VarargsInvoker use exact size match layout for carrier type for varargs parameters.
> Use sprintf as the test case, tested on Mac OS X, need verification on Windows to verify the needed share library is
> loaded by JVM.

I guess this works, although, from a puristic perspective, in C when you call a variadic function, the trailing
arguments are promoted to either `int`, or `double` or left alone (for numerics bigger than `unsigned int`). In other
words, when you pass a `char` to a `printf` call, C will never really pass a `char` there - it will pass an int. It
would be interesting to to do some experiments, where `printf` is invoked and some *negative* `short` or `byte` number
is passed in, to see if the C code displays the number correctly, or if the lack of adequate sign extension is creating


Marked as reviewed by mcimadamore (Committer).

PR: https://git.openjdk.java.net/panama-foreign/pull/164

More information about the panama-dev mailing list