Fix Go support to use appropriate interface for entering and leaving
C/C++ code, depending on GCC version. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13146 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8fe63be051
commit
7ec208da05
2 changed files with 76 additions and 13 deletions
|
|
@ -326,6 +326,8 @@ private:
|
|||
|
||||
Swig_banner(f_c_begin);
|
||||
|
||||
Printf(f_c_runtime, "#define SWIGMODULE %s\n", module);
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Printf(f_c_runtime, "#define SWIG_DIRECTORS\n");
|
||||
|
||||
|
|
@ -349,6 +351,15 @@ private:
|
|||
|
||||
Printf(f_go_begin, "\npackage %s\n\n", package);
|
||||
|
||||
Printf(f_go_runtime, "//extern %sSwigCgocall\n", module);
|
||||
Printf(f_go_runtime, "func SwigCgocall()\n");
|
||||
Printf(f_go_runtime, "//extern %sSwigCgocallDone\n", module);
|
||||
Printf(f_go_runtime, "func SwigCgocallDone()\n");
|
||||
Printf(f_go_runtime, "//extern %sSwigCgocallBack\n", module);
|
||||
Printf(f_go_runtime, "func SwigCgocallBack()\n");
|
||||
Printf(f_go_runtime, "//extern %sSwigCgocallBackDone\n", module);
|
||||
Printf(f_go_runtime, "func SwigCgocallBackDone()\n\n");
|
||||
|
||||
// All the C++ wrappers should be extern "C".
|
||||
|
||||
Printv(f_c_wrappers, "#ifdef __cplusplus\n", "extern \"C\" {\n", "#endif\n\n", NULL);
|
||||
|
|
@ -941,8 +952,8 @@ private:
|
|||
}
|
||||
|
||||
if (gccgo_flag) {
|
||||
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tSwigCgocall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer SwigCgocallDone()\n", NULL);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "\t", NULL);
|
||||
|
|
@ -2538,8 +2549,8 @@ private:
|
|||
Printv(f_go_wrappers, "\tp := &", director_struct_name, "{0, v}\n", NULL);
|
||||
|
||||
if (gccgo_flag) {
|
||||
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tSwigCgocall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer SwigCgocallDone()\n", NULL);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "\tp.", class_receiver, " = ", fn_name, NULL);
|
||||
|
|
@ -3049,11 +3060,6 @@ private:
|
|||
|
||||
Printv(f_go_wrappers, " {\n", NULL);
|
||||
|
||||
if (gccgo_flag) {
|
||||
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "\tif swig_g, swig_ok := swig_p.v.(", interface_name, "); swig_ok {\n", NULL);
|
||||
Printv(f_go_wrappers, "\t\t", NULL);
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
|
|
@ -3076,6 +3082,12 @@ private:
|
|||
Printv(f_go_wrappers, "\t\treturn\n", NULL);
|
||||
}
|
||||
Printv(f_go_wrappers, "\t}\n", NULL);
|
||||
|
||||
if (gccgo_flag) {
|
||||
Printv(f_go_wrappers, "\tSwigCgocall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer SwigCgocallDone()\n", NULL);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "\t", NULL);
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f_go_wrappers, "return ", NULL);
|
||||
|
|
@ -3222,8 +3234,8 @@ private:
|
|||
Printv(f_go_wrappers, " {\n", NULL);
|
||||
|
||||
if (gccgo_flag) {
|
||||
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tSwigCgocall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer SwigCgocallDone()\n", NULL);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "\t", NULL);
|
||||
|
|
@ -3269,8 +3281,8 @@ private:
|
|||
Printv(f_go_wrappers, "{\n", NULL);
|
||||
|
||||
if (gccgo_flag) {
|
||||
Printv(f_go_wrappers, "\tsyscall.Exitsyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer syscall.Entersyscall()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tSwigCgocallBack()\n", NULL);
|
||||
Printv(f_go_wrappers, "\tdefer SwigCgocallBackDone()\n", NULL);
|
||||
}
|
||||
|
||||
Printv(f_go_wrappers, "\t", NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue