Giter Site home page Giter Site logo

Why memory is empty about wasmkit HOT 10 OPEN

996ccs avatar 996ccs commented on May 27, 2024
Why memory is empty

from wasmkit.

Comments (10)

kateinoigakukun avatar kateinoigakukun commented on May 27, 2024

What do you mean "memory is empty"? The parsed module has WasmKit.Memory in memories and WasmKit.DataSegment in data.

from wasmkit.

996ccs avatar 996ccs commented on May 27, 2024

What do you mean "memory is empty"? The parsed module has WasmKit.Memory in memories and WasmKit.DataSegment in data.

Yes, look at the output of WasmKit.Export(name: "memory", descriptor: WasmKit.ExportDescriptor.memory(0))]

from wasmkit.

kateinoigakukun avatar kateinoigakukun commented on May 27, 2024

@996ccs WasmKit.ExportDescriptor.memory(0) means the export entry points to the index 0 of memories

from wasmkit.

996ccs avatar 996ccs commented on May 27, 2024

@996ccs WasmKit.ExportDescriptor.memory(0) means the export entry points to the index 0 of memories

Thank you very much for your reply. Please tell me how to obtain the initializer data in WasmKit.DataSegment. Like this data WasmKit.DataSegment.Active(index: 0, offset: [WasmKit.Instruction.numericConst(I32(1048))], initializer: ArraySlice([2, 0, 0, 0, 22, 0, 0, 0 , 104, 0, 101, 0, 108, 0, 108, 0, 111, 0, 32, 0, 119, 0, 111, 0, 114, 0, 108, 0, 100]))) How do I get initializer.

from wasmkit.

kateinoigakukun avatar kateinoigakukun commented on May 27, 2024

I don't understand what you are trying to do but you can get the data segment initializer by something like below:

let initializer = switch dataSegment {
case .active(let active): Array(active.initializer)
case .passive(let initializer): initializer
}

from wasmkit.

996ccs avatar 996ccs commented on May 27, 2024

I don't understand what you are trying to do but you can get the data segment initializer by something like below:

let initializer = switch dataSegment {
case .active(let active): Array(active.initializer)
case .passive(let initializer): initializer
}

I used the code you provided and encountered the same problem myself. The error message 'initializer' is inaccessible due to 'internal' protection level

from wasmkit.

kateinoigakukun avatar kateinoigakukun commented on May 27, 2024

Could you try it again with main branch of WasmKit?

from wasmkit.

996ccs avatar 996ccs commented on May 27, 2024

Could you try it again with main branch of WasmKit?

I updated version 0.04, and now the data under the module cannot be accessed. My need is to get the initializer: ArraySlice in WasmParser.DataSegment.active. Can it be exposed? Thanks

from wasmkit.

kateinoigakukun avatar kateinoigakukun commented on May 27, 2024

Ah, sorry. If you just want to extract data segment, you can use WasmParser module directly.

from wasmkit.

996ccs avatar 996ccs commented on May 27, 2024

Ah, sorry. If you just want to extract data segment, you can use WasmParser module directly.

Can you tell me what I should do? Because I am not good at wasmkit and swift development

from wasmkit.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.