# SDL: emscripten: Restore compatibility with existing emsdk releases. (b93a8)

**URL:** <https://discourse.libsdl.org/t/sdl-emscripten-restore-compatibility-with-existing-emsdk-releases-b93a8/46132>\
**Category:** SDL Commits\
**Created:** [September 20, 2023, 6:40pm UTC](https://discourse.libsdl.org/t/sdl-emscripten-restore-compatibility-with-existing-emsdk-releases-b93a8/46132 "2023-09-20T18:40:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 20, 2023, 6:40pm UTC](https://discourse.libsdl.org/t/sdl-emscripten-restore-compatibility-with-existing-emsdk-releases-b93a8/46132/1 "2023-09-20T18:40:09Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/b93a8a86abcc772f4200ca610d76eb6283afd14c>
>
> (cherry picked from commit 5008521538ffe7931ecd0d11c4a5e75a05f54b5b)

```diff
From b93a8a86abcc772f4200ca610d76eb6283afd14c Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 20 Sep 2023 14:32:41 -0400
Subject: [PATCH] emscripten: Restore compatibility with existing emsdk
 releases.

(cherry picked from commit 5008521538ffe7931ecd0d11c4a5e75a05f54b5b)
---
 src/SDL_assert.c | 12 ++++++++++--
 src/video/emscripten/SDL_emscriptenmouse.c | 9 +++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/SDL_assert.c b/src/SDL_assert.c
index f036fc3e6d0c..fe7619be1c84 100644
--- a/src/SDL_assert.c
+++ b/src/SDL_assert.c
@@ -42,7 +42,15 @@
 #endif
 
 #if defined( __EMSCRIPTEN__ )
-#include <emscripten.h>
+ #include <emscripten.h>
+ /* older Emscriptens don't have this, but we need to for wasm64 compatibility. */
+ #ifndef MAIN_THREAD_EM_ASM_PTR
+ #ifdef __wasm64__
+ #error You need to upgrade your Emscripten compiler to support wasm64
+ #else
+ #define MAIN_THREAD_EM_ASM_PTR MAIN_THREAD_EM_ASM_INT
+ #endif
+ #endif
 #endif
 
 /* The size of the stack buffer to use for rendering assert messages. */
@@ -251,7 +259,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
         for (;;) {
             SDL_bool okay = SDL_TRUE;
             /* *INDENT-OFF* */ /* clang-format off */
- char *buf = (char *) EM_ASM_PTR({
+ char *buf = (char *) MAIN_THREAD_EM_ASM_PTR({
                 var str =
                     UTF8ToString($0) + '\n\n' +
                     'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :';
diff --git a/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c
index a5a5e5844e7b..51829d4870bb 100644
--- a/src/video/emscripten/SDL_emscriptenmouse.c
+++ b/src/video/emscripten/SDL_emscriptenmouse.c
@@ -31,6 +31,15 @@
 
 #include "../../events/SDL_mouse_c.h"
 
+/* older Emscriptens don't have this, but we need to for wasm64 compatibility. */
+#ifndef MAIN_THREAD_EM_ASM_PTR
+ #ifdef __wasm64__
+ #error You need to upgrade your Emscripten compiler to support wasm64
+ #else
+ #define MAIN_THREAD_EM_ASM_PTR MAIN_THREAD_EM_ASM_INT
+ #endif
+#endif
+
 static SDL_Cursor *Emscripten_CreateCursorFromString(const char *cursor_str, SDL_bool is_custom)
 {
     SDL_Cursor *cursor;

```
