GraalVM supports most Foreign Functions and Memory features.
Downcalls and upcalls must be declared in a file called reachability-metadata.json:
- For all downcalls, the native signatures must be declared (without the function name).
- Fall al upcalls, the native signature must declared (without a function name) and the called Java function must be declared.
For details, see GraalVM: Foreign Function and Memory API in Native Image.
Code generated by the Windows API Generator is fully compatible with GraalVM.
In addition, it can generated the reachability-metadata.json file. To do so,
use the reachabilityMetadataFile configuration option of the Maven or Gradle
plug-in.
The path to the JSON file can either be specified on the command line
(-H:ConfigurationFileDirectories=/path/to/config-dir/), in the native-image.properties file
in META-INF/native-image directory or it can be put into
the META-INF/native-image/{groupId}/{artifactId} directory.
Note: The Windows API Generator does not generate the upcall declarations required if COM interfaces are implemented in Java or Kotlin. The downcall declarations for calling COM interfaces are generated.
A full example can be found in native.