mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
cgo: support errno value as second return parameter
Making this work on all targets was interesting but there's now a test in place to make sure this works on all targets that have the CGo test enabled (which is almost all targets).
This commit is contained in:
@@ -86,3 +86,16 @@ func AdjustTimeOffset(offset int64) {
|
||||
// TODO: do this atomically?
|
||||
timeOffset += offset
|
||||
}
|
||||
|
||||
// Picolibc is not configured to define its own errno value, instead it calls
|
||||
// __errno_location.
|
||||
// TODO: a global works well enough for now (same as errno on Linux with
|
||||
// -scheduler=tasks), but this should ideally be a thread-local variable stored
|
||||
// in task.Task.
|
||||
// Especially when we add multicore support for microcontrollers.
|
||||
var errno int32
|
||||
|
||||
//export __errno_location
|
||||
func libc_errno_location() *int32 {
|
||||
return &errno
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user