go_.go 594 B

123456789101112131415161718192021
  1. package api
  2. // Here we export cgo wrappers for our plain Go functions
  3. // They handle the conversion between Go and C types
  4. // Note: cgo exports cannot be in the same file as cgo preamble funtions,
  5. // which is why this file cannot be combined with "py_.go"
  6. import "C"
  7. //export go_api_sayGoodbye
  8. func go_api_sayGoodbye() {
  9. // We could just export sayGoodbye directly because it has no arguments
  10. // But for completion we are adding an export
  11. sayGoodbye()
  12. }
  13. //export go_api_concat
  14. func go_api_concat(a *C.char, b *C.char) *C.char {
  15. return C.CString(concat(C.GoString(a), C.GoString(b)))
  16. }