I want to use golang to call ruby's dll,there is a function of c codeļ¼
long rb_num2int(VALUE);
and I use syscall in golang to call the function like that:
type VALUE uint64
func rb_num2int(val VALUE) int32 {
ret, _, _ := Rb_num2int.Call(
uintptr(unsafe.Pointer(&val)),
)
return int32(ret)
}
finally when I use ruby to call the golang's so file, there have error :
Exception 0xc0000005 0x0 0x746e 0x6498cdd4
PC=0x6498cdd4
signal arrived during external code execution
syscall.Syscall(0x648af790, 0x1, 0xc0420600a8, 0x0, 0x0, 0x0, 0x0, 0x0)
C:/Go/src/runtime/syscall_windows.go:171 +0xf9
syscall.(*Proc).Call(0xc04205a4a0, 0xc0420600b0, 0x1, 0x1, 0x10, 0x67823060, 0x1, 0xc0420600b0)
C:/Go/src/syscall/dll_windows.go:146 +0xa4
syscall.(*LazyProc).Call(0xc042074270, 0xc0420600b0, 0x1, 0x1, 0xc04203de98, 0x67784ae3, 0xc042052058, 0x0)
C:/Go/src/syscall/dll_windows.go:302 +0x66
main.rb_num2int(0x2cbdc78, 0x0)
C:/Users/ABC/go/src/sketchup/main.go:57 +0x8e
main.add(0x2cbdc78, 0x3, 0x5)
C:/Users/ABC/go/src/sketchup/main.go:81 +0x36
rax 0x746e
rbx 0xc0420600a8
rcx 0xc0420600a8
rdi 0xc0420600a8
rsi 0x99
rbp 0x62f170
rsp 0x62f140
r8 0x62f1c0
r9 0xc21
r10 0x0
r11 0x8101010101010100
r12 0x62f1c0
r13 0x0
r14 0x0
r15 0x100
rip 0x6498cdd4
rflags 0x10202
cs 0x33
fs 0x53
gs 0x2b
Any suggestions on what should I do?
User contributions licensed under CC BY-SA 3.0