I figured this one out too. I built a debug version and at run time a message 
appeared in the console telling me I need to add HEAP8 to 
EXPORTED_RUNTIME_METHODS. After doing that my apps work except for one test 
which is failing and which I will investigate now..

Regards

    -Mark

> On May 24, 2025, at 19:03, キャロウ マーク <git...@callow.im> wrote:
> 
> After fixing the raw pointer issue I asked about in another thread, a new 
> problem has cropped up. Whenever my app tries to call a native function on 
> the created module I get the subject error.
> 
> Here is a typical stack trace
> 
> Uncaught (in promise) TypeError: handle is undefined
>     __emval_get_property http://192.168.50.139:8080/libktx.js:7
>     anonymous http://192.168.50.139:8080/libktx.js line 7 > Function:9
>     testCreate http://192.168.50.139:8080/libktx-webgl/libktx-test.js:802
> 
> I am using -sMODULARIZE and I instantiate the module with
> 
>   createKtxModule({preinitializedWebGLContext: gl}).then(instance => {
>     window.ktx = instance;
>     // Make existing WebGL context current for Emscripten OpenGL.
>     ktx.GL.makeContextCurrent(
>                 ktx.GL.createContext(document.getElementById("glcanvas"),
>                                         { majorVersion: 2.0 })
>                 );
>     main()
>   });
> 
> where createKtxModule is the export name. That call to 
> ktx.GL.makeContextCurrent is working but I suppose that is not a native 
> function.
> 
> Everything was working on 4.0.7.
> 
> I read https://emscripten.org/docs/compiling/Modularized-Output.html but 
> can’t see any change required when continuing to use -sMODULARIZE.
> 
> Does anyone know how to fix this?
> 
> I am horrified by the number of breakages these supposedly minor patch 
> releases (4.0.8 and 4.0.9) have caused in my code. I have spent 2 days on 
> fixes so far.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to emscripten-discuss+unsubscr...@googlegroups.com 
> <mailto:emscripten-discuss+unsubscr...@googlegroups.com>.
> To view this discussion visit 
> https://groups.google.com/d/msgid/emscripten-discuss/AEC5B023-EDF3-48E3-9F5F-70B9C6C454DB%40callow.im
>  
> <https://groups.google.com/d/msgid/emscripten-discuss/AEC5B023-EDF3-48E3-9F5F-70B9C6C454DB%40callow.im?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/emscripten-discuss/2FF5087F-10FB-4D5C-A955-12CD6F3D4B19%40callow.im.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to