LibWasm is a library to read Webassembly files.
There are two ways to read a Webassembly file:
- Use
readModule
to get aWasmModule
. - Use
readUninterpreted
to get aWasmUninterpretedModule
. Both take anInputStream
-struct, you obtain by callingopenInputStream
with the filename as argument. Returns NULL, if the file couldn't be openend. The difference betweenWasmModule
andWasmUninterpretedModule
is that in the first LibWasm tries to interpret each section, so you can simply do:wasmModule->importSection
to access the import section. In the latter, the order of the sections is preserved, so you have to callfindImportSection
to get either NULL or a pointer to the importSection. To release a module usedeleteModule
ordeleteUninterpretedModule
.