Last active
June 3, 2020 08:05
-
-
Save mtfelian/4c2b1a9b8b3b4001413fd09554cb63bc to your computer and use it in GitHub Desktop.
How to fill and pass C struct from Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options := &C.GDALGridLinearOptions{dfRadius: C.double(-1.0), dfNoDataValue: C.double(0.0)} | |
C.someCall(unsafe.Pointer(options)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options := (*C.GDALGridLinearOptions)(C.malloc(C.size_t(C.sizeof_GDALGridLinearOptions))) | |
defer C.free(unsafe.Pointer(options)) | |
(*options).dfRadius = C.double(-1.0) | |
(*options).dfNoDataValue = C.double(0.0) | |
C.someCall(unsafe.Pointer(options)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment