diff --git a/_demo/getcwd/getcwd.go b/_demo/getcwd/getcwd.go new file mode 100644 index 00000000..ce2dcfea --- /dev/null +++ b/_demo/getcwd/getcwd.go @@ -0,0 +1,11 @@ +package main + +import ( + "github.com/goplus/llgo/c" + "github.com/goplus/llgo/c/os" +) + +func main() { + wd := os.Getcwd(c.Alloca(os.PATH_MAX), os.PATH_MAX) + c.Printf(c.Str("cwd: %s\n"), wd) +} diff --git a/ssa/abi/abi.go b/ssa/abi/abi.go index 25298272..127e36cb 100644 --- a/ssa/abi/abi.go +++ b/ssa/abi/abi.go @@ -154,7 +154,8 @@ func (b *Builder) TypeName(t types.Type) (ret string, pub bool) { return fmt.Sprintf("[%v]%s", t.Len(), ret), pub case *types.Named: o := t.Obj() - return "_llgo_" + TypeName(o), o.Exported() + pkg := o.Pkg() + return "_llgo_" + FullName(pkg, o.Name()), (pkg == nil || o.Exported()) case *types.Interface: if t.Empty() { return "_llgo_any", true