Skip to content

[BUG] does not work with cgo #16

@glycerine

Description

@glycerine

I know krd does not need CGO, but it should work with it for projects which still use CGO
for things other than the race detector.

With latest racedetector v0.7.0:

$ go version
go version go1.25.3 linux/amd64
$ git clone https://github.com/glycerine/goq
$ cd goq
$ racedetector test -v
...
Instrumented: workstart.go
  - 12 writes, 11 reads instrumented
Instrumented: xc.go
  - 7 writes, 16 reads instrumented
Instrumented: xs.go
  - 13 writes, 31 reads instrumented
go: warning: "all" matched no packages
# github.com/glycerine/goq
# [github.com/glycerine/goq]
./inspecterrno.go:17:17: could not determine what C.addr_of_errno refers to
./inspecterrno.go:21:13: could not determine what C.errno_itself refers to
FAIL    github.com/glycerine/goq [build failed]
FAIL
$ find . -name inspecterrno.go
./inspecterrno.go
$ cat inspecterrno.go 
package main

// #include <errno.h>
// void* addr_of_errno() {
//   return &errno;
// }
// int errno_itself() {
//   return errno;
// }
import "C"

func GetAddrErrno() uintptr {
        return uintptr(C.addr_of_errno())
}

func GetErrno() int {
        return int(C.errno_itself())
}
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions