golang/go

cmd/cgo: signal arrived during external code execution that calls setjmp on Windows

Open

#13.672 aperta il 18 dic 2015

Vedi su GitHub
 (33 commenti) (0 reazioni) (0 assegnatari)Go (19.008 fork)batch import
NeedsFixOS-Windowshelp wanted

Metriche repository

Star
 (133.883 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Processor Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz OS: Windows 7 64 golang:1.5.2 gcc:mingw-w64 version 5.2.0 x86_64-posix-seh-rt_v4-rev1

When I compile golang with some external c code which using the setjmp and longjmp,the program crash.

My c code is here (It's in a c file in a directory which implements package lua)

#include <stdio.h>
#include <setjmp.h>
void Print(){
    jmp_buf c;
    if(setjmp(c)==0){
        longjmp(c,1);
    }
    else{
        printf("receive an exception\n");
    }
}

My go code

package main
import "github.com/redstorm-fyy/go-lua/lua"
func main() {
    lua.Print()
}

Important! It crashes when the c code is in an external file.When the c code is just up the .go file's import "C",It does not crash.

Crash information Exception 0xc0000028 0x0 0x0 0x77b096f8 PC=0x77b096f8 signal arrived during external code execution

github.com/redstorm-fyy/go-lua/lua._Cfunc_Print() ??:0 +0x38 github.com/redstorm-fyy/go-lua/lua.Print() E:/GolangRoot/src/github.com/redstorm-fyy/go-lua/lua/luago.go:587 +0x1b main.main() E:/GolangRoot/src/github.com/redstorm-fyy/go-lua/example/exam.go:6 +0x1b

goroutine 17 [syscall, locked to thread]: runtime.goexit() c:/go/src/runtime/asm_amd64.s:1721 +0x1 rax 0xf rbx 0xc0000028 rcx 0x22ebd0 rdi 0x22c000 rsi 0x22f7b0 rbp 0x22f230 rsp 0x22eb10 r8 0x0 r9 0x400000 r10 0x0 r11 0x22f330 r12 0x22fe60 r13 0x22fdb0 r14 0x4013e8 r15 0x584024 rip 0x77b096f8 rflags 0x202 cs 0x33 fs 0x53 gs 0x2b

Guida contributor