demo: don't use symlinks for x/tools compatible

This commit is contained in:
Li Jie
2024-12-31 19:54:30 +08:00
parent 03b469212e
commit c602038597
14 changed files with 254 additions and 6 deletions

24
_demo/cgofull/py.go Normal file
View File

@@ -0,0 +1,24 @@
package main
/*
#cgo pkg-config: python3-embed
#include <Python.h>
*/
import "C"
import "fmt"
func Initialize() {
C.Py_Initialize()
}
func Finalize() {
C.Py_Finalize()
}
func Run(code string) error {
if C.PyRun_SimpleString(C.CString(code)) != 0 {
C.PyErr_Print()
return fmt.Errorf("failed to run code")
}
return nil
}