mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +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:
Vendored
+8
@@ -1,5 +1,6 @@
|
||||
package main
|
||||
|
||||
import "syscall"
|
||||
import "unsafe"
|
||||
|
||||
var _ unsafe.Pointer
|
||||
@@ -31,6 +32,13 @@ func C.CBytes(b []byte) unsafe.Pointer {
|
||||
return C.__CBytes(b)
|
||||
}
|
||||
|
||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
||||
func C.__get_errno_num() uintptr
|
||||
|
||||
func C.__get_errno() error {
|
||||
return syscall.Errno(C.__get_errno_num())
|
||||
}
|
||||
|
||||
type (
|
||||
C.char uint8
|
||||
C.schar int8
|
||||
|
||||
Reference in New Issue
Block a user