Skip to content

[Proposal] Use GraalVM Polyglot #25

@electronstudio

Description

@electronstudio

GraalVM can call code in any supported language from any supported language, and one of the 'languages' is LLVM bitcode.

Compiling Raylib to LLVM bitcode works fine. However we then have some problems:

  1. Passing a Java string as a function argument doesn't work because it doesn't convert it to a char*.
       Context polyglot = Context.newBuilder().
               allowAllAccess(true).build();
       File file = new File("libraylib.so.3.7.0");
       Source source = Source.newBuilder("llvm", file).build();
       Value cpart = polyglot.eval(source);
       cpart.invokeMember("InitWindow", 300, 300, "foo");

You can also do 'execute' rather than 'invokeMember' but the result is the same:

Exception in thread "main" org.graalvm.polyglot.PolyglotException: com.oracle.truffle.api.dsl.UnsupportedSpecializationException: Unexpected values provided for <core.c:664:29>:664 LLVMI8LoadNodeGen#1: [foo], [String]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions