From 199c10975c3ed739f1216f67624c86df52df6cc0 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Tue, 21 Jun 2022 14:55:01 -0400 Subject: [PATCH 1/2] Prefix Init C function to avoid conflicts with other native libraries --- isolate.go | 2 +- v8go.cc | 2 +- v8go.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/isolate.go b/isolate.go index 661fbec0..e2275970 100644 --- a/isolate.go +++ b/isolate.go @@ -53,7 +53,7 @@ type HeapStatistics struct { // Context, rather than creating a new default Isolate. func NewIsolate() *Isolate { v8once.Do(func() { - C.Init() + C.V8goInit() }) iso := &Isolate{ ptr: C.NewIsolate(), diff --git a/v8go.cc b/v8go.cc index 97390883..2bc8061c 100644 --- a/v8go.cc +++ b/v8go.cc @@ -143,7 +143,7 @@ extern "C" { ISOLATE_SCOPE(iso); \ m_ctx* ctx = isolateInternalContext(iso); -void Init() { +void V8goInit() { #ifdef _WIN32 V8::InitializeExternalStartupData("."); #endif diff --git a/v8go.h b/v8go.h index 7acaf042..afe39e10 100644 --- a/v8go.h +++ b/v8go.h @@ -131,7 +131,7 @@ typedef struct { int sign_bit; } ValueBigInt; -extern void Init(); +extern void V8goInit(); extern IsolatePtr NewIsolate(); extern void IsolatePerformMicrotaskCheckpoint(IsolatePtr ptr); extern void IsolateDispose(IsolatePtr ptr); From 1f7d6a308446e039b1d47f8088881cf353034ed3 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Tue, 21 Jun 2022 14:58:13 -0400 Subject: [PATCH 2/2] Prefix Version function with V8go prefix --- v8go.cc | 2 +- v8go.go | 2 +- v8go.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v8go.cc b/v8go.cc index 2bc8061c..bc44cf0c 100644 --- a/v8go.cc +++ b/v8go.cc @@ -1615,7 +1615,7 @@ ValuePtr FunctionSourceMapUrl(ValuePtr ptr) { /********** v8::V8 **********/ -const char* Version() { +const char* V8goVersion() { return V8::GetVersion(); } diff --git a/v8go.go b/v8go.go index 32990558..4f4f454d 100644 --- a/v8go.go +++ b/v8go.go @@ -17,7 +17,7 @@ import ( // Version returns the version of the V8 Engine with the -v8go suffix func Version() string { - return C.GoString(C.Version()) + return C.GoString(C.V8goVersion()) } // SetFlags sets flags for V8. For possible flags: https://github.com/v8/v8/blob/master/src/flags/flag-definitions.h diff --git a/v8go.h b/v8go.h index afe39e10..3874330f 100644 --- a/v8go.h +++ b/v8go.h @@ -298,7 +298,7 @@ extern RtnValue FunctionCall(ValuePtr ptr, RtnValue FunctionNewInstance(ValuePtr ptr, int argc, ValuePtr args[]); ValuePtr FunctionSourceMapUrl(ValuePtr ptr); -const char* Version(); +const char* V8goVersion(); extern void SetFlags(const char* flags); #ifdef __cplusplus