export c header file for build library

This commit is contained in:
Li Jie
2025-09-11 14:07:58 +08:00
parent 729e5772a0
commit 3605eeeef7
5 changed files with 1465 additions and 45 deletions

View File

@@ -435,6 +435,7 @@ func (p Program) NewPackage(name, pkgPath string) Package {
pyobjs: pyobjs, pymods: pymods, strs: strs,
chkabi: chkabi, Prog: p,
di: nil, cu: nil, glbDbgVars: glbDbgVars,
export: make(map[string]string),
}
ret.abi.Init(pkgPath)
return ret
@@ -693,6 +694,8 @@ type aPackage struct {
NeedRuntime bool
NeedPyInit bool
export map[string]string // pkgPath.nameInPkg => exportname
}
type Package = *aPackage
@@ -701,6 +704,14 @@ func (p Package) Module() llvm.Module {
return p.mod
}
func (p Package) SetExport(name, export string) {
p.export[name] = export
}
func (p Package) ExportFuncs() map[string]string {
return p.export
}
func (p Package) rtFunc(fnName string) Expr {
p.NeedRuntime = true
fn := p.Prog.runtime().Scope().Lookup(fnName).(*types.Func)