generated from Over-Run/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Basic
squid233 edited this page May 4, 2024
·
1 revision
Use an interface or an abstract class to define functions.
#include <stdio.h>
void helloWorld() { printf("Hello world!"); }
Compile and link it as a dynamic library.
interface MyLib {
MyLib INSTANCE = Downcall.load(MethodHandles.lookup(), "example.dll");
void helloWorld();
}
To detect multi-platform, see https://github.com/Over-Run/platform.
See javadoc of StructAllocator
for more information.
interface Point {
StructAllocator<Point> OF = new StructAllocator(
MethodHandles.lookup(),
LayoutBuilder.struct().cInt("x").cInt("y").build()
);
int x();
int y();
}