Skip to content

Passing two plugins as part of javy build #915

@suyashsharma

Description

@suyashsharma

I have created a custom plugin i.e. javy_test_plugin by following this link - https://github.com/bytecodealliance/javy/blob/main/docs/docs-using-extending.md

Now I would like to dynamic link this plugin while building the wasm from js file.

I am running below command to build the dynamic wasm module -

javy build -C dynamic=y -C plugin="quickjs.wasm" -C plugin="javy_test_plugin.wasm" read-import.js -o read-import.wasm

quickjs.wasm is generated by running below command

javy emit-plugin -o quickjs.wasm

On inspecting the generated wasm module i.e read-import.wasm, I am seeing only these imports coming from javy_test_plugin . It is not showing javy_quickjs_provider_v3 related imports

wasm-objdump -x read-import.wasm

Import[3]:
 - func[0] sig=2 <test-plugin.canonical_abi_realloc> <- test-plugin.canonical_abi_realloc
 - func[1] sig=1 <test-plugin.invoke> <- test-plugin.invoke
 - memory[0] pages: initial=0 <- test-plugin.memory

Interestingly on running the build as below and inspecting the generated wasm module. I can see below

javy build -C dynamic=y -C plugin="quickjs.wasm" read-import.js -o read-import.wasm

wasm-objdump -x read-import.wasm

Import[3]:
 - func[0] sig=2 <javy_quickjs_provider_v3.canonical_abi_realloc> <- javy_quickjs_provider_v3.canonical_abi_realloc
 - func[1] sig=1 <javy_quickjs_provider_v3.invoke> <- javy_quickjs_provider_v3.invoke

So to me looks like only one of the plugin is getting linked in this command, which is the later one - -C plugin="javy_test_plugin.wasm". Is there any way I can link both the plugins together so that I can see both of these namespaces in generated module.

Import[3]:

  • func[0] sig=2 <javy_quickjs_provider_v3.canonical_abi_realloc> <- javy_quickjs_provider_v3.canonical_abi_realloc
  • func[1] sig=1 <javy_quickjs_provider_v3.invoke> <- javy_quickjs_provider_v3.invoke

Import[3]:

  • func[0] sig=2 <test-plugin.canonical_abi_realloc> <- test-plugin.canonical_abi_realloc
  • func[1] sig=1 <test-plugin.invoke> <- test-plugin.invoke
  • memory[0] pages: initial=0 <- test-plugin.memory

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions