Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix Init and Version C functions with V8go to avoid conflicts with other native libraries #324

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion isolate.go
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions v8go.cc
Expand Up @@ -137,7 +137,7 @@ extern "C" {
ISOLATE_SCOPE(iso); \
m_ctx* ctx = isolateInternalContext(iso);

void Init() {
void V8goInit() {
#ifdef _WIN32
V8::InitializeExternalStartupData(".");
#endif
Expand Down Expand Up @@ -1661,7 +1661,7 @@ ValuePtr FunctionSourceMapUrl(ValuePtr ptr) {

/********** v8::V8 **********/

const char* Version() {
const char* V8goVersion() {
return V8::GetVersion();
}

Expand Down
2 changes: 1 addition & 1 deletion v8go.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions v8go.h
Expand Up @@ -135,7 +135,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);
Expand Down Expand Up @@ -304,7 +304,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
Expand Down