mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-07 10:37:39 +08:00
feat: build windows dll and call dll in flutter
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
package main
|
||||
|
||||
import "C"
|
||||
import "polaris/cmd"
|
||||
import (
|
||||
"os"
|
||||
"polaris/cmd"
|
||||
"polaris/log"
|
||||
)
|
||||
|
||||
func main() {}
|
||||
|
||||
//export Start
|
||||
func Start() {
|
||||
cmd.Start()
|
||||
cmd.Start(true)
|
||||
}
|
||||
|
||||
//export Stop
|
||||
func Stop() {
|
||||
log.Infof("stop polaris")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"polaris/db"
|
||||
"polaris/log"
|
||||
"polaris/server"
|
||||
)
|
||||
|
||||
func Start(sharedLib bool) {
|
||||
if sharedLib || os.Getenv("GIN_MODE") == "release" {
|
||||
log.InitLogger(true)
|
||||
} else {
|
||||
log.InitLogger(false)
|
||||
}
|
||||
|
||||
func Start() {
|
||||
log.Infof("------------------- Starting Polaris ---------------------")
|
||||
|
||||
dbClient, err := db.Open()
|
||||
if err != nil {
|
||||
log.Panicf("init db error: %v", err)
|
||||
|
||||
@@ -3,5 +3,5 @@ package main
|
||||
import "polaris/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Start()
|
||||
cmd.Start(false)
|
||||
}
|
||||
Reference in New Issue
Block a user