when I create an new type from C type and then use it as a function 
parameter type, in function that I want to be exported then everything is OK

main.go:
package main

import "C"

type MyInt C.int

//export f
func f(x tests.MyInt) {
}

and then 

$ go build -v -buildmode=c-shared -o main.so main.go

but when the type is in another package, it won't compile

test.go:
package tests


import "C"


type MyInt C.int

main.go:
package main


import "C"


import "github.com/microo8/tests"


//export f
func f(x tests.MyInt) {
}

then:
$ go build -v -buildmode=c-shared -o main.so main.go                       
                                                                            
                                                                            
      ~
runtime/internal/sys
runtime/internal/atomic
runtime
internal/race
sync/atomic
sync
syscall
runtime/cgo
github.com/microo8/tests
command-line-arguments
# command-line-arguments
./main.go:8:10: Go type not supported in export: tests.MyInt
./main.go:8:10: Go type not supported in export: tests.MyInt
 λ - go build -v -buildmode=c-shared -o main.so main.go                     
                                                                            
                                                                            
        ~
runtime/internal/sys
runtime/internal/atomic
runtime
internal/race
sync/atomic
sync
syscall
runtime/cgo
github.com/microo8/tests
command-line-arguments
# command-line-arguments
./main.go:8:10: Go type not supported in export: tests.MyInt
./main.go:8:10: Go type not supported in export: tests.MyInt

why is that? the MyInt type is just an alias of C.int. or?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to