1
Fork 0
hermetic_cc_toolchain/test/cgo/cgo.go

18 lines
315 B
Go
Raw Normal View History

// Copyright 2023 Uber Technologies, Inc.
// Licensed under the Apache License, Version 2.0
2021-06-07 22:33:34 +03:00
package main
// #include <stdio.h>
2022-01-28 15:49:24 +02:00
// char* hello() { return "hello, world"; }
// void phello() { printf("%s\n", hello()); }
2021-06-07 22:33:34 +03:00
import "C"
func main() {
C.phello()
2022-01-28 14:40:03 +02:00
}
2022-01-28 15:57:22 +02:00
func Chello() string {
2022-01-28 14:40:03 +02:00
return C.GoString(C.hello())
2021-06-07 22:33:34 +03:00
}