在阅读 v8 的源代码时,我有一部分不是很了解。
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator =
v8::ArrayBuffer::Allocator::NewDefaultAllocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
我跟踪了 v8::Isolate::New 的实现,然后我发现了以下代码:
// static
Isolate* Isolate::Allocate() {
return reinterpret_cast<Isolate*>(i::Isolate::New());
}
因为我多读了一点代码,我知道“i”的意思是“内部”,但我不确定其余部分。 v8::Isolate 和 v8::internal::Isolate 兼容吗?
最佳答案
通常,C++ 库在需要声明/定义库使用但不应该使用的东西时使用internal
(通常也称为detail
)命名空间供用户使用。
这是一种类似于“图书馆链接”的方式。希望如果/当模块到达 C++ 时,我们将有更好的方法来处理这个问题。
关于c++ - 命名空间 v8 和命名空间 v8::internal 之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54606331/