diff options
Diffstat (limited to 'src/cmd/cgo/doc.go')
-rw-r--r-- | src/cmd/cgo/doc.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 955b7c495..efbeae958 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -70,7 +70,7 @@ assignment context to retrieve both the return value (if any) and the C errno variable as an error (use _ to skip the result value if the function returns void). For example: - n, err := C.atoi("abc") + n, err := C.sqrt(-1) _, err := C.voidFunc() In C, a function argument written as a fixed size array @@ -484,16 +484,16 @@ The directives are: Example: #pragma cgo_dynamic_linker "/lib/ld-linux.so.2" -#pragma cgo_export <local> <remote> +#pragma cgo_export_dynamic <local> <remote> - In both internal and external linking modes, put the Go symbol + In internal linking mode, put the Go symbol named <local> into the program's exported symbol table as <remote>, so that C code can refer to it by that name. This mechanism makes it possible for C code to call back into Go or to share Go's data. For compatibility with current versions of SWIG, - #pragma dynexport is an alias for #pragma cgo_export. + #pragma dynexport is an alias for #pragma cgo_export_dynamic. #pragma cgo_import_static <local> @@ -505,6 +505,14 @@ The directives are: Example: #pragma cgo_import_static puts_wrapper +#pragma cgo_export_static <local> <remote> + + In external linking mode, put the Go symbol + named <local> into the program's exported symbol table as + <remote>, so that C code can refer to it by that name. This + mechanism makes it possible for C code to call back into Go or + to share Go's data. + #pragma cgo_ldflag "<arg>" In external linking mode, invoke the host linker (usually gcc) |