File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,8 @@ class WasmBase : public std::enable_shared_from_this<WasmBase> {
172
172
std::unique_ptr<ShutdownHandle> shutdown_handle_;
173
173
std::unordered_set<ContextBase *> pending_done_; // Root contexts not done during shutdown.
174
174
175
- WasmCallVoid<0 > _start_; /* Emscripten v1.39.0+ */
175
+ WasmCallVoid<0 > _initialize_; /* Emscripten v1.39.17+ */
176
+ WasmCallVoid<0 > _start_; /* Emscripten v1.39.0+ */
176
177
WasmCallVoid<0 > __wasm_call_ctors_;
177
178
178
179
WasmCallWord<1 > malloc_;
Original file line number Diff line number Diff line change 33
33
namespace proxy_wasm {
34
34
35
35
void NullPlugin::getFunction (std::string_view function_name, WasmCallVoid<0 > *f) {
36
- if (function_name == " _start" ) {
36
+ if (function_name == " _initialize" ) {
37
+ *f = nullptr ;
38
+ } else if (function_name == " _start" ) {
37
39
*f = nullptr ;
38
40
} else if (function_name == " __wasm_call_ctors" ) {
39
41
*f = nullptr ;
Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ void WasmBase::registerCallbacks() {
193
193
194
194
void WasmBase::getFunctions () {
195
195
#define _GET (_fn ) wasm_vm_->getFunction (#_fn, &_fn##_);
196
+ _GET (_initialize);
196
197
_GET (_start);
197
198
_GET (__wasm_call_ctors);
198
199
@@ -324,8 +325,9 @@ ContextBase *WasmBase::getOrCreateRootContext(const std::shared_ptr<PluginBase>
324
325
}
325
326
326
327
void WasmBase::startVm (ContextBase *root_context) {
327
- /* Call "_start" function, and fallback to "__wasm_call_ctors" if the former is not available. */
328
- if (_start_) {
328
+ if (_initialize_) {
329
+ _initialize_ (root_context);
330
+ } else if (_start_) {
329
331
_start_ (root_context);
330
332
} else if (__wasm_call_ctors_) {
331
333
__wasm_call_ctors_ (root_context);
You can’t perform that action at this time.
0 commit comments