github xgo-dev/llgo v0.8.1

latest releases: v1.0.6, v1.0.5, v1.0.4...
2 years ago

highlights:

  • Now you can import a Python library in llgo!

features:

changes:

  • llgo/ssa: fix types named recursive (#147)
  • mv x/<tool> => xtool/<tool> (#143)
  • nmindex: query auto add _ prefix (#144)

Python support

You can import a Python library in llgo! For example:

package main

import (
	"github.com/goplus/llgo/c"
	"github.com/goplus/llgo/py"
	"github.com/goplus/llgo/py/math"
)

func main() {
	x := math.Sqrt(py.Float(2))
	c.Printf(c.Str("sqrt(2) = %f\n"), x.Float64())
}

Here, We call py.Float(2) to create a Python floating point number 2, and pass it to Python’s math.sqrt to get x. Then use x.Float64() to convert the Python object to Go's float64 type, and finally we print the value through C printf.

Don't miss a new llgo release

NewReleases is sending notifications on new releases.