From 343ea75fa399e70c88fdc4247d8dfac625198441 Mon Sep 17 00:00:00 2001 From: xhd2015 Date: Sat, 18 May 2024 11:11:50 +0800 Subject: [PATCH] add runtime/hook --- cmd/xgo/runtime_gen/core/version.go | 4 ++-- cmd/xgo/runtime_gen/hook/hook.go | 23 +++++++++++++++++++++++ cmd/xgo/version.go | 4 ++-- runtime/core/version.go | 4 ++-- runtime/hook/hook.go | 23 +++++++++++++++++++++++ 5 files changed, 52 insertions(+), 6 deletions(-) create mode 100755 cmd/xgo/runtime_gen/hook/hook.go create mode 100644 runtime/hook/hook.go diff --git a/cmd/xgo/runtime_gen/core/version.go b/cmd/xgo/runtime_gen/core/version.go index 5f9cc99c..7c693e0c 100755 --- a/cmd/xgo/runtime_gen/core/version.go +++ b/cmd/xgo/runtime_gen/core/version.go @@ -7,8 +7,8 @@ import ( ) const VERSION = "1.0.35" -const REVISION = "38ce9874b261e60788217c05946dae60dff3d4fd+1" -const NUMBER = 217 +const REVISION = "3431198dea60ee1a41ed69b93034c5919aba32b5+1" +const NUMBER = 218 // these fields will be filled by compiler const XGO_VERSION = "" diff --git a/cmd/xgo/runtime_gen/hook/hook.go b/cmd/xgo/runtime_gen/hook/hook.go new file mode 100755 index 00000000..7a8c982b --- /dev/null +++ b/cmd/xgo/runtime_gen/hook/hook.go @@ -0,0 +1,23 @@ +package hook + +import ( + "fmt" + "os" +) + +func __xgo_link_on_init_finished(f func()) { + fmt.Fprintln(os.Stderr, "WARNING: failed to link __xgo_link_on_init_finished(requires xgo).") +} + +func __xgo_link_init_finished() bool { + fmt.Fprintln(os.Stderr, "WARNING: failed to link __xgo_link_init_finished(requires xgo).") + return false +} + +func OnInitFinished(f func()) { + __xgo_link_on_init_finished(f) +} + +func InitFinished() bool { + return __xgo_link_init_finished() +} diff --git a/cmd/xgo/version.go b/cmd/xgo/version.go index 0db44af9..91b205f2 100644 --- a/cmd/xgo/version.go +++ b/cmd/xgo/version.go @@ -3,8 +3,8 @@ package main import "fmt" const VERSION = "1.0.35" -const REVISION = "38ce9874b261e60788217c05946dae60dff3d4fd+1" -const NUMBER = 217 +const REVISION = "3431198dea60ee1a41ed69b93034c5919aba32b5+1" +const NUMBER = 218 func getRevision() string { revSuffix := "" diff --git a/runtime/core/version.go b/runtime/core/version.go index 5f9cc99c..7c693e0c 100644 --- a/runtime/core/version.go +++ b/runtime/core/version.go @@ -7,8 +7,8 @@ import ( ) const VERSION = "1.0.35" -const REVISION = "38ce9874b261e60788217c05946dae60dff3d4fd+1" -const NUMBER = 217 +const REVISION = "3431198dea60ee1a41ed69b93034c5919aba32b5+1" +const NUMBER = 218 // these fields will be filled by compiler const XGO_VERSION = "" diff --git a/runtime/hook/hook.go b/runtime/hook/hook.go new file mode 100644 index 00000000..7a8c982b --- /dev/null +++ b/runtime/hook/hook.go @@ -0,0 +1,23 @@ +package hook + +import ( + "fmt" + "os" +) + +func __xgo_link_on_init_finished(f func()) { + fmt.Fprintln(os.Stderr, "WARNING: failed to link __xgo_link_on_init_finished(requires xgo).") +} + +func __xgo_link_init_finished() bool { + fmt.Fprintln(os.Stderr, "WARNING: failed to link __xgo_link_init_finished(requires xgo).") + return false +} + +func OnInitFinished(f func()) { + __xgo_link_on_init_finished(f) +} + +func InitFinished() bool { + return __xgo_link_init_finished() +}