-
Notifications
You must be signed in to change notification settings - Fork 4
Trouble with struct argument #33
Copy link
Copy link
Closed
Labels
abi: system-vSystem V AMD64 ABI (Linux/macOS x86-64)System V AMD64 ABI (Linux/macOS x86-64)arch: amd64x86-64 specific (System V / Win64 ABI)x86-64 specific (System V / Win64 ABI)feature: structsStruct passing/return (HFA, by-value)Struct passing/return (HFA, by-value)priority: highImportant for next releaseImportant for next releasestatus: confirmedVerified, ready for workVerified, ready for worktype: bugSomething isn't workingSomething isn't working
Metadata
Metadata
Assignees
Labels
abi: system-vSystem V AMD64 ABI (Linux/macOS x86-64)System V AMD64 ABI (Linux/macOS x86-64)arch: amd64x86-64 specific (System V / Win64 ABI)x86-64 specific (System V / Win64 ABI)feature: structsStruct passing/return (HFA, by-value)Struct passing/return (HFA, by-value)priority: highImportant for next releaseImportant for next releasestatus: confirmedVerified, ready for workVerified, ready for worktype: bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
I was having some problems with a struct argument not being passed to a function correctly. So I created a very simple example, and it still doesn't seem to work.
foo.hfoo.c# build the shared object gcc -c -Wall -Werror -fpic foo.c gcc -shared -o libfoo.so foo.omain-cgo.go# prove that the shared library works with cgo LD_LIBRARY_PATH=. go run main-cgo.go a=42 b=19main-goffi.go# call the foo function using goffi CGO_ENABLED=0 LD_LIBRARY_PATH=. go run main-goffi.go a=1101152704 b=2028 CGO_ENABLED=0 LD_LIBRARY_PATH=. go run main-goffi.go a=-1580326472 b=11683It prints apparently random values.
What on earth am I doing wrong? Is goffi not for general use, and only expected to work with webgpu?