lyhu / wasmer-java-sample

wasmer-java-sample
2 stars 0 forks source link

请问一下import的部分有使用demo吗 #1

Open SnailQxQ opened 2 months ago

SnailQxQ commented 2 months ago

部分代码: List imports = new ArrayList<>(); Imports.Spec abortSpec = new Imports.Spec("env", "abort", new Function<List, List>() { @Override public List apply(List numbers) { return List.of(); } }, Arrays.asList(Type.I32, Type.I32, Type.I32, Type.I32), Collections.emptyList());

    imports.add(abortSpec);
    Module module = new Module(code);
    Imports importsObject = Imports.from(imports , module);
    Instance instance = module.instantiate(importsObject);
    System.out.println(instance);

Instance instance = module.instantiate(importsObject); 报错 Exception in thread "main" java.lang.UnsatisfiedLinkError: 'long org.wasmer.Imports.nativeImportsInstantiate(java.util.List, long)'

SnailQxQ commented 2 months ago

我也参考了 Salpadding/wasmer-jni ,但是用那个包也没传入成功