fix: change clite's LLGoPackage to true to execute its init()
This commit is contained in:
6
1
Normal file
6
1
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Merge branch 'main' of https://github.com/goplus/llgo into emb-runtime
|
||||||
|
# Please enter a commit message to explain why this merge is necessary,
|
||||||
|
# especially if it merges an updated upstream into a topic branch.
|
||||||
|
#
|
||||||
|
# Lines starting with '#' will be ignored, and an empty message aborts
|
||||||
|
# the commit.
|
||||||
@@ -21,7 +21,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LLGoPackage = "link"
|
// we want to execute init(), link / decl skips executing init()
|
||||||
|
LLGoPackage = true
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|||||||
@@ -18,9 +18,12 @@
|
|||||||
|
|
||||||
package c
|
package c
|
||||||
|
|
||||||
import _ "unsafe"
|
import (
|
||||||
|
_ "unsafe"
|
||||||
|
|
||||||
// initialized by z_print because LLGoPackage skips calling init()
|
"github.com/goplus/lib/c"
|
||||||
var Stdin FilePtr
|
)
|
||||||
var Stdout FilePtr
|
|
||||||
var Stderr FilePtr
|
var Stdin FilePtr = c.Fopen(c.Str("/dev/stdin"), c.Str("r"))
|
||||||
|
var Stdout FilePtr = c.Fopen(c.Str("/dev/stdout"), c.Str("w"))
|
||||||
|
var Stderr FilePtr = Stdout
|
||||||
|
|||||||
@@ -22,18 +22,6 @@ import (
|
|||||||
c "github.com/goplus/llgo/runtime/internal/clite"
|
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
if c.Stdin == nil {
|
|
||||||
c.Stdin = c.Fopen(c.Str("/dev/stdin"), c.Str("r"))
|
|
||||||
}
|
|
||||||
if c.Stdout == nil {
|
|
||||||
c.Stdout = c.Fopen(c.Str("/dev/stdout"), c.Str("w"))
|
|
||||||
}
|
|
||||||
if c.Stderr == nil {
|
|
||||||
c.Stderr = c.Stdout
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func boolCStr(v bool) *c.Char {
|
func boolCStr(v bool) *c.Char {
|
||||||
if v {
|
if v {
|
||||||
return c.Str("true")
|
return c.Str("true")
|
||||||
|
|||||||
Reference in New Issue
Block a user