by explicitly casting between BigInt and Number within EM_JS() blocks.
//! Print message to Module.printMessage callback.
EM_JS(void, occJSPrintMessage, (const char* theStr, int theGravity), {
+ const aStr = Number(theStr); // bigintToI53Checked(theStr);
if (Module.printMessage != undefined && Module.printMessage != null)
{
- Module.printMessage(UTF8ToString(theStr), theGravity);
+ Module.printMessage(UTF8ToString(aStr), theGravity);
}
else if (Module.print != undefined && Module.print != null)
{
- Module.print(UTF8ToString(theStr));
+ Module.print(UTF8ToString(aStr));
}
else
{
- // console.info (UTF8ToString(theStr));
+ // console.info (UTF8ToString(aStr));
}
});
#include <emscripten/emscripten.h>
//! Print message to console.debug().
-EM_JS(void, occJSConsoleDebug, (const char* theStr), { console.debug(UTF8ToString(theStr)); });
+EM_JS(void, occJSConsoleDebug, (const char* theStr), {
+ const aStr = Number(theStr); // bigintToI53Checked(theStr);
+ console.debug(UTF8ToString(aStr));
+});
//! Print message to console.info().
-EM_JS(void, occJSConsoleInfo, (const char* theStr), { console.info(UTF8ToString(theStr)); });
+EM_JS(void, occJSConsoleInfo, (const char* theStr), {
+ const aStr = Number(theStr); // bigintToI53Checked(theStr);
+ console.info(UTF8ToString(aStr));
+});
//! Print message to console.warn().
-EM_JS(void, occJSConsoleWarn, (const char* theStr), { console.warn(UTF8ToString(theStr)); });
+EM_JS(void, occJSConsoleWarn, (const char* theStr), {
+ const aStr = Number(theStr); // bigintToI53Checked(theStr);
+ console.warn(UTF8ToString(aStr));
+});
//! Print message to console.error().
-EM_JS(void, occJSConsoleError, (const char* theStr), { console.error(UTF8ToString(theStr)); });
+EM_JS(void, occJSConsoleError, (const char* theStr), {
+ const aStr = Number(theStr); // bigintToI53Checked(theStr);
+ console.error(UTF8ToString(aStr));
+});
#else
#include <syslog.h>
#include <emscripten.h>
//! Return WebAssembly heap size in bytes.
-EM_JS(size_t, OSD_MemInfo_getModuleHeapLength, (), { return Module.HEAP8.length; });
+EM_JS(double, OSD_MemInfo_getModuleHeapLength, (), { return Module.HEAP8.length; });
#endif
// =======================================================================
}
if (IsActive(MemVirtual))
{
- myCounters[MemVirtual] = OSD_MemInfo_getModuleHeapLength();
+ myCounters[MemVirtual] = (size_t)OSD_MemInfo_getModuleHeapLength();
}
#elif (defined(__linux__) || defined(__linux))
if (IsActive(MemHeapUsage))
}
#ifdef __EMSCRIPTEN__
EM_ASM_(
- { Module.ctx.getBufferSubData($0, $1, HEAPU8.subarray($2, $2 + $3)); },
+ { Module.ctx.getBufferSubData($0, Number($1), HEAPU8.subarray(Number($2), Number($2 + $3))); },
theTarget,
theOffset,
theData,
#endif
#if defined(__EMSCRIPTEN__)
+ #if defined(_LP64)
+EM_JS(char*, occJSNumberToPtr, (double thePtr), { return BigInt(thePtr); });
+ #else
+EM_JS(char*, occJSNumberToPtr, (double thePtr), { return thePtr; });
+ #endif
+
//! Return DOM id of default WebGL canvas from Module.canvas.
EM_JS(char*, occJSModuleCanvasId, (), {
const aCanvasId = Module.canvas.id;
const aNbBytes = lengthBytesUTF8(aCanvasId) + 1;
const aStrPtr = Module._malloc(aNbBytes);
stringToUTF8(aCanvasId, aStrPtr, aNbBytes);
- return aStrPtr;
+ return occJSNumberToPtr(aStrPtr);
});
//! Return DOM id of default WebGL canvas from Module.canvas.