Example #1
0
        private void Initialize(Interop.EngineHandle engine)
        {
            if (engine.IsInvalid)
            {
                throw new WasmtimeException("Failed to create Wasmtime engine.");
            }

            var store = Interop.wasm_store_new(engine);

            if (store.IsInvalid)
            {
                throw new WasmtimeException("Failed to create Wasmtime store.");
            }

            var linker = Interop.wasmtime_linker_new(store);

            if (linker.IsInvalid)
            {
                throw new WasmtimeException("Failed to create Wasmtime linker.");
            }

            Interop.wasmtime_linker_allow_shadowing(linker, allowShadowing: true);

            Engine = engine;
            Store  = store;
            Linker = linker;
        }
Example #2
0
        private void Initialize(Interop.EngineHandle engine)
        {
            if (engine.IsInvalid)
            {
                throw new WasmtimeException("Failed to create Wasmtime engine.");
            }

            var store = Interop.wasm_store_new(engine);

            if (store.IsInvalid)
            {
                throw new WasmtimeException("Failed to create Wasmtime store.");
            }

            _engine = engine;
            _handle = store;
        }