[foreign-memaccess+abi] RFR: 8308858: FFM API and strings [v2]

Christoph Läubrich duke at openjdk.org
Thu Jun 8 04:07:13 UTC 2023


On Wed, 7 Jun 2023 23:37:50 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>  But there's another way to look at this which says that the number of terminator bytes is unrelated from the charset, and it's only related to the notional C type that is used to model the character in the C string 

That's exactly what I mean, while *theoretically* I can choose any charset and do strange things on Java by defining a custom one, _practically_ I have no choice (most of the time) as I can't use a random charset but must use the one chosen by the c-code I interact with and that side will most probably choose one that fits the data-type and c-conventions.

So if this String-To-C-Using-Charset can make it easier for me (e.g maybe handle the `wchar_t` 16 vs 32 bit) I think that would be enough, for really special cases one can still write custom code, but most of the time I use it charset in C means "system-encoding" (if not ASCII).

-------------

PR Comment: https://git.openjdk.org/panama-foreign/pull/836#issuecomment-1581859633


More information about the panama-dev mailing list