github.com/primecitizens/pcz/std@v0.2.1/ffi/wasm/wasi/args.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2023 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build wasip1 9 10 package wasi 11 12 import ( 13 "unsafe" 14 ) 15 16 //go:wasmimport wasi_snapshot_preview1 args_sizes_get 17 //go:noescape 18 func args_sizes_get(argc, argvBufLen unsafe.Pointer) Errno 19 20 func ArgsSizes() (argc, totalBytes Size, errno Errno) { 21 var n, sz Size 22 errno = args_sizes_get(unsafe.Pointer(&n), unsafe.Pointer(&sz)) 23 return n, sz, errno 24 } 25 26 // ArgsGet depends on values returned by args_sizes_get 27 // argv is [argc]uint32 28 // argv is [totalBytes]byte 29 // 30 //go:wasmimport wasi_snapshot_preview1 args_get 31 //go:noescape 32 func ArgsGet(argv, argvBuf unsafe.Pointer) Errno