From 02b582fcdb3ef5f7c50771ddc6bdaaa0de8e4c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BA=A2=E5=B2=A9?= Date: Wed, 19 Jul 2023 17:08:29 +0800 Subject: [PATCH] A: demo tempdll --- example/tempdll/tempdll.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 example/tempdll/tempdll.go diff --git a/example/tempdll/tempdll.go b/example/tempdll/tempdll.go new file mode 100644 index 0000000..c05902c --- /dev/null +++ b/example/tempdll/tempdll.go @@ -0,0 +1,33 @@ +package main + +import ( + "github.com/energye/energy/v2/cef" +) + +// 该示例采用tempdll方式 +// 该方式不再需要手动或自动安装liblcl.xx +// 需要通过编译命令控制该方式的开启 +// 编译命令 -tags="tempdll" +// windows: go build -ldflags "-H windowsgui -s -w" -tags="tempdll" +// linux: go build -ldflags "-s -w" -tags="tempdll" +// macos: go build -ldflags "-s -w" -tags="tempdll" +// 可通过 upx 工具压缩编译好的执行文件 + +func main() { + // SetDllSaveDirType 设置 liblcl 保存目录,默认系统临时目录 + //tempdll.TempDLL.SetDllSaveDirType(tempdll.TddEnergyHome) + // 设置保存目录 DllSaveDirType = TddCustom 时生效 + //tempdll.TempDLL.SetDllSaveDir("/save/to/path/liblcl.xx") + + // 使用编译命令: go build -tags="tempdll" + // 开发工具 Goland: 在运行配置中 Go tool arguments 中配置 -tags="tempdll" + + //全局初始化 每个应用都必须调用的 + cef.GlobalInit(nil, nil) + //创建应用 + app := cef.NewApplication() + //指定一个URL地址,或本地html文件目录 + cef.BrowserWindow.Config.Url = "https://www.baidu.com" + //运行应用 + cef.Run(app) +} -- GitLab