ebitengine / purego

Apache License 2.0
1.95k stars 63 forks source link

darwin purego call dll by go gernate panic #185

Closed jiftle closed 6 months ago

jiftle commented 6 months ago

darwin amd64 go version go1.20.5 darwin/amd64

  1. go genernater *.dylib
  2. go code call this *.dylib by purego, first, the simple version function is right. but the open hid device error by gohid.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2b0175c5]

goroutine 1 [running, locked to thread]:
runtime.throw({0x2b2ce71f?, 0x0?})
    /usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc00063ea30 sp=0xc00063ea00 pc=0x2b037c1d
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:825 +0x3e9 fp=0xc00063ea90 sp=0xc00063ea30 pc=0x2b04ec69
runtime.writeHeapBits.flush({0xc00063eac0?, 0x1f90278?, 0x1026c40?, 0x1893dc0?}, 0x1?, 0xc00063eab8?)
    /usr/local/go/src/runtime/mbitmap.go:868 +0x85 fp=0xc00063eab0 sp=0xc00063ea90 pc=0x2b0175c5
runtime.heapBitsSetType(0xc00052fb10, 0x10, 0x10, 0x2b396f80)
    /usr/local/go/src/runtime/mbitmap.go:1082 +0x290 fp=0xc00063eb68 sp=0xc00063eab0 pc=0x2b0179b0
runtime.mallocgc(0x10, 0x2b396f80, 0x1)
    /usr/local/go/src/runtime/malloc.go:1074 +0x5c7 fp=0xc00063ebd0 sp=0xc00063eb68 pc=0x2b00f9e7
runtime.newobject(0x2b2b47b0?)
    /usr/local/go/src/runtime/malloc.go:1254 +0x27 fp=0xc00063ebf8 sp=0xc00063ebd0 pc=0x2b00fe07
github.com/sstallion/go-hid.Enumerate.func1(0xc000000000?)
    /Users/mac/wsp/gowork/pkg/mod/github.com/sstallion/go-hid@v0.14.1/hid.go:145 +0x28 fp=0xc00063ec20 sp=0xc00063ebf8 pc=0x2b2ada88
github.com/sstallion/go-hid.Enumerate(0xecc0?, 0x63?, 0xc00063ecb0)
    /Users/mac/wsp/gowork/pkg/mod/github.com/sstallion/go-hid@v0.14.1/hid.go:145 +0x66 fp=0xc00063ec68 sp=0xc00063ec20 pc=0x2b2ad986
ndev/hidcrd.HidDeviceOpen()
    /Users/mac/wsp/ndev/hidcrd/hidwapper.go:18 +0x47 fp=0xc00063ece0 sp=0xc00063ec68 pc=0x2b2b10c7
ndev/hidcrd.(*hidCrd).Open(0x2b66f970)
    /Users/mac/wsp/ncelang/ndev/hidcrd/api.go:30 +0xa5 fp=0xc00063ed68 sp=0xc00063ece0 pc=0x2b2ae805
main.HidPcd_Open(0xc00040b800, 0xc00052c8a4)
    /Users/mac/wsp/ncelang/ncelang-ndev/export.go:45 +0x11c fp=0xc00063edf8 sp=0xc00063ed68 pc=0x2b2b2bfc
TotallyGamerJet commented 6 months ago

Please provide code to reproduce the issue.

TotallyGamerJet commented 6 months ago

No way to move forward with this so closing.