Debian Codegraph @

struct_other.go

raw
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3
4 //go:build !(amd64 || arm || arm64 || loong64 || ppc64le || riscv64 || s390x)
5
6 package purego
7
8 import (
9 "reflect"
10 "unsafe"
11 )
12
13 // This file provides the struct-handling helpers for architectures that do
14 // not support struct arguments or returns: 386, and any architecture reachable
15 // only through the integer-only cgo fallback. Every struct operation panics.
16
17 func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any {
18 panic("purego: struct arguments are not supported on this architecture")
19 }
20
21 func getStruct(outType reflect.Type, syscall syscallArgs) reflect.Value {
22 panic("purego: struct returns are not supported on this architecture")
23 }
24
25 // structReturnInMemory reports whether a struct return value is returned through
26 // a caller-allocated hidden pointer. Structs are unsupported on this
27 // architecture, so it always reports false.
28 func structReturnInMemory(reflect.Type) bool {
29 return false
30 }
31
32 // shouldBundleStackArgs always returns false because C-style stack argument
33 // bundling is only needed on Darwin ARM64.
34 func shouldBundleStackArgs(v reflect.Value, numInts, numFloats int) bool {
35 return false
36 }
37
38 func collectStackArgs(args []reflect.Value, startIdx int, numInts, numFloats int,
39 keepAlive []any, addInt, addFloat, addStack func(uintptr),
40 pNumInts, pNumFloats, pNumStack *int) ([]reflect.Value, []any) {
41 panic("purego: collectStackArgs should not be called on this architecture")
42 }
43
44 func bundleStackArgs(stackArgs []reflect.Value, addStack func(uintptr)) {
45 panic("purego: bundleStackArgs should not be called on this architecture")
46 }
47
48 func getCallbackStruct(inType reflect.Type, frame unsafe.Pointer, floatsN *int, intsN *int, stackSlot *int, stackByteOffset *uintptr) reflect.Value {
49 panic("purego: struct callback arguments are not supported on this architecture")
50 }
51
52 func setStruct(a *callbackArgs, ret reflect.Value) {
53 panic("purego: struct returns are not supported on this architecture")
54 }