Skip to content

Commit

Permalink
Allow wasm plugins to grow memory by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Dec 29, 2024
1 parent e278a55 commit 74a2e66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ switch("lineTrace", "on")
let outputName = projectName() & ".wasm"
# Pass this to Emscripten linker to generate html file scaffold for us.
# No need for main, it's standalone wasm, and we dont need to error on undefined as we're probably importing
switch("passL", "--no-entry -sSTANDALONE_WASM=1 -sERROR_ON_UNDEFINED_SYMBOLS=0 -g")
switch("passL", "--no-entry -sSTANDALONE_WASM=1 -sERROR_ON_UNDEFINED_SYMBOLS=0 -g -sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=4294967296")
switch("passL", "-o wasm/" & outputName)
6 changes: 2 additions & 4 deletions scripting/plugin_runtime.nim
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ var anyCallbacks = initTable[int, proc(args: JsonNode): JsonNode]()
var onEditorModeChanged* = initEvent[tuple[editor: EditorId, oldMode: string, newMode: string]]()
var callbackId = 0

when defined(wasm):
const env* = "wasm"
else:
const env* = "nims"
proc emscripten_notify_memory_growth*(a: int32) {.exportc.} = discard
const env* = "wasm"

proc info*(args: varargs[string, `$`]) =
var msgLen = 0
Expand Down

0 comments on commit 74a2e66

Please sign in to comment.