golang调用ruby dll

时间:2018-07-05 10:39:07

标签: ruby go dll

我想用golang调用ruby的dll,有c代码的功能:

long rb_num2int(VALUE);

然后我在golang中使用syscall来调用该函数:

type VALUE uint64

func rb_num2int(val VALUE) int32 {
    ret, _, _ := Rb_num2int.Call(
        uintptr(unsafe.Pointer(&val)),
    )
    return int32(ret)
}

最后,当我使用ruby调用golang的so文件时,出现错误:

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

关于我该怎么办的任何建议?

0 个答案:

没有答案