From b1654f7807b9e94e7edc2447ace93b12425fbad9 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Sun, 4 Aug 2024 10:54:41 +0800 Subject: [PATCH] c/os: llgoClearenv --- c/os/_os/os.c | 2 +- c/os/os.go | 5 ----- c/os/os_linux.go | 4 ++++ c/os/os_other.go | 7 ++++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/c/os/_os/os.c b/c/os/_os/os.c index af3c5085..5dd2fac7 100644 --- a/c/os/_os/os.c +++ b/c/os/_os/os.c @@ -1,6 +1,6 @@ #include -int llgo_clearenv() { +int llgoClearenv() { extern char **environ; if (environ != NULL) { *environ = NULL; diff --git a/c/os/os.go b/c/os/os.go index 7950f996..bcd97fe6 100644 --- a/c/os/os.go +++ b/c/os/os.go @@ -27,11 +27,6 @@ import ( "github.com/goplus/llgo/c/syscall" ) -const ( - LLGoFiles = "_os/os.c" - LLGoPackage = "link" -) - const ( PATH_MAX = C.PATH_MAX ) diff --git a/c/os/os_linux.go b/c/os/os_linux.go index b58dc1e2..0ea364b6 100644 --- a/c/os/os_linux.go +++ b/c/os/os_linux.go @@ -20,5 +20,9 @@ package os import "C" +const ( + LLGoPackage = "decl" +) + //go:linkname Clearenv C.clearenv func Clearenv() diff --git a/c/os/os_other.go b/c/os/os_other.go index 138195fd..ae78cd41 100644 --- a/c/os/os_other.go +++ b/c/os/os_other.go @@ -20,5 +20,10 @@ package os import "C" -//go:linkname Clearenv C.llgo_clearenv +const ( + LLGoFiles = "_os/os.c" + LLGoPackage = "link" +) + +//go:linkname Clearenv C.llgoClearenv func Clearenv()