Hi,
I try to recompile Go for a new platform which is a s390x platform using 
Clang instead of GCC. I can not work for C string in CGO. Apparently char 
in unsigned by default on my platform and building even the simple CGO 
program always fails with this error:

*/home/user/tmp/go-build468743286/b001/_cgo_gotypes.go:175:25: undefined: 
_Ctype_char*

the code is:

package main

//#include <stdio.h>
//char* callC() {
// return "Calling C code!";
//}
import "C"

import "fmt"

func main() {
        fmt.Println("Convert C String to Go String")
        str := C.GoString(C.callC())
        fmt.Println(str)
}

to overcome this I modified the gcc.go file in src/cmd/cgo and added this:

if s == "uchar" {
                s = "char"
            }
            name := c.Ident("_Ctype_" + s)
I don't now how CGO always convert my char* to *_Ctype_uchar instead of 
*_Ctype_char.
Anyone have a clue on this?


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5fdcd5ec-7589-46bf-b20e-b27a8002dd30o%40googlegroups.com.

Reply via email to