-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux - Datatype to large to pass by value? #153
Comments
Btw: Using the same code as above on Windows, will result in a crash. But changing this line to a pointer will make it work then: Why can I pass a pointer, when the C function needs a struct? |
Purego does not support structs. You can change the C code to take a pointer to a struct which is allowed. |
This has to do with the Windows ABI. I'm unfamiliar with that ABI but I'm assuming that's just how they pass structs. |
@TotallyGamerJet Are there any plans to support structs or is this impossible with Linux? |
Hopefully, but I don't have the bandwidth to do it. Currently, #88 tracks structs and has some workarounds for macOS. Please close this if there are no additional issues |
Folder structure:
foo.c
Compile foo.c into .so library:
gcc -shared -o libfoo.so foo.c
Set LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)
main.go
go run .
prints the following output:id: 0, width: 0, height: 0, mipmaps: 0, format: 0
Changing the fields to 8-bit datatype:
The result is correct then:
id: 1, width: 64, height: 64, mipmaps: 1, format: 7
The text was updated successfully, but these errors were encountered: