Skip to content

Commit

Permalink
demo: getcwd; abi.TypeName fix: error interface is public
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jun 19, 2024
1 parent 3ead4b4 commit 6cb42a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions _demo/getcwd/getcwd.go
Original file line number Diff line number Diff line change
@@ -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)
}
3 changes: 2 additions & 1 deletion ssa/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6cb42a4

Please sign in to comment.