JDK-8298096 : Refine javadoc for Linker
  • Type: Enhancement
  • Component: core-libs
  • Priority: P3
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2022-12-05
  • Updated: 2022-12-05
Related Reports
Relates :  
Description
For the nativeLinker, I think it may be helpful to say more about platform-specific mappings of C types, perhaps even defining a future programmatic interface. For example, the package-level docs discuss getting a MethodHandle around C's strlen using FunctionDescriptor.of(ValueLayout.JAVA_LONG, ValueLayout.ADDRESS). At a C level, strlen is defined as having a signature of "size_t strlen(const char *str)" it isn't surprising a linker would map the unsigned size_t to a Java long, but it isn't obvious either, or necessarily the only choice all all the platform a JVM would be run on (such as 32-bit).