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> {
172172 std::unique_ptr<ShutdownHandle> shutdown_handle_;
173173 std::unordered_set<ContextBase *> pending_done_; // Root contexts not done during shutdown.
174174
175- WasmCallVoid<0 > _start_; /* Emscripten v1.39.0+ */
175+ WasmCallVoid<0 > _initialize_; /* Emscripten v1.39.17+ */
176+ WasmCallVoid<0 > _start_; /* Emscripten v1.39.0+ */
176177 WasmCallVoid<0 > __wasm_call_ctors_;
177178
178179 WasmCallWord<1 > malloc_;
Original file line number Diff line number Diff line change 3333namespace proxy_wasm {
3434
3535void 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" ) {
3739 *f = nullptr ;
3840 } else if (function_name == " __wasm_call_ctors" ) {
3941 *f = nullptr ;
Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ void WasmBase::registerCallbacks() {
193193
194194void WasmBase::getFunctions () {
195195#define _GET (_fn ) wasm_vm_->getFunction (#_fn, &_fn##_);
196+ _GET (_initialize);
196197 _GET (_start);
197198 _GET (__wasm_call_ctors);
198199
@@ -324,8 +325,9 @@ ContextBase *WasmBase::getOrCreateRootContext(const std::shared_ptr<PluginBase>
324325}
325326
326327void 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_) {
329331 _start_ (root_context);
330332 } else if (__wasm_call_ctors_) {
331333 __wasm_call_ctors_ (root_context);
You can’t perform that action at this time.
0 commit comments