17 lines
512 B
Java
17 lines
512 B
Java
import java.io.*;
|
|
import org.graalvm.polyglot.*;
|
|
|
|
class Demo {
|
|
public static void main(String[] args) throws IOException {
|
|
Context polyglot = Context.newBuilder().
|
|
allowAllAccess(true).build();
|
|
File file = new File("libtrueog-final.bc");
|
|
Source source = Source.newBuilder("llvm", file).build();
|
|
polyglot.eval(source);
|
|
Value cpart = polyglot.getBindings("llvm").getMember("hello");
|
|
int a = cpart.execute(10).asInt();
|
|
System.out.println(a);
|
|
}
|
|
}
|
|
|