示例#1
0
文件: Host.cs 项目: riclxu/wasmtime
        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;
        }
示例#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;
        }