emscripten_set_main_loop change causes breakage

32 views
Skip to first unread message

Tim Tommerson

unread,
Feb 20, 2025, 12:30:53 PMFeb 20
to emscripten-discuss
Hello,

I recently hit a snag using nim with emscripten. The issue was caused by a recent commit:

The commit changes the type signatures to bool from int which caused an issue with ctype support in the nim language. This may be specific to the integration of emsdk as opposed to nimlang itself. However I just wanted to ask here if the change to bool from int would cause more issues down the line, specifically in regard to C23 and its redefinition of bool. 

Ive engaged with the nimlang matrix chat to make them at least aware of the issue. The fix from there end for me at least was to add a hackyfix to the ctypes to make it work, though that will have to change when C23 is supported I guess. 

thanks for your time

Sam Clegg

unread,
Feb 20, 2025, 2:00:31 PMFeb 20
to emscripte...@googlegroups.com
Could you elaborate a little bit on what the problem with using `bool` is?   Could you perhaps link to your issue/discussion?

We use `bool` a bunch now in emscripten, including at the wasm/JS boundary.

I have seen one issue where we were passing values other than 1 or 0, and the C compiler was treating it as undefined behaviour.

Other than that, I don't think I've heard of any other issues.    If this issue seems like a serious blocker on your side perhaps open an issue in the bug tracker and we can continue discussion there?

cheers,
sam


--
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-disc...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/4bd55732-08fb-4241-b74a-3f5039778ed9n%40googlegroups.com.

Tim Tommerson

unread,
Feb 20, 2025, 2:38:06 PMFeb 20
to emscripte...@googlegroups.com
Hello ,

Thanks for your reply. I am doing this for fun, so its not a huge deal. And possibly a learning experience as this is all new to me, so I apologize if I am confusing.

I recently tried using a few projects which use emscipten via nimlang -> emscripten integration. When I checkout the latest  packages the recent change to bool from int , emsdk
cause emscripten compilation to fail (From what I gather on the nimlang side). So Im sure now this is likely an issue with either nimland or nico(the nimlang game engine im using).

Initially reverting the change from bool back to int fixed everything. Since that didnt feel right to me the only other way I could get it to stop complaining was by adding the following to nim and nico: 


Now I'm not naive enough to think this actually solves the issue, it just brought me to the end of compilation and seems to work. I am simply trying to illuminate the problem and looking into where to look/how to resolve it. 








Tim Tommerson

unread,
Feb 20, 2025, 2:38:11 PMFeb 20
to emscripte...@googlegroups.com
Well I think I know to look into the nico/nimlang side of things now at least.

Thank you for your help!

On Thu, Feb 20, 2025 at 2:00 PM 'Sam Clegg' via emscripten-discuss <emscripte...@googlegroups.com> wrote:

Sam Clegg

unread,
Feb 20, 2025, 2:42:55 PMFeb 20
to emscripte...@googlegroups.com
On Thu, Feb 20, 2025 at 11:38 AM Tim Tommerson <tim666...@gmail.com> wrote:
Hello ,

Thanks for your reply. I am doing this for fun, so its not a huge deal. And possibly a learning experience as this is all new to me, so I apologize if I am confusing.

I recently tried using a few projects which use emscipten via nimlang -> emscripten integration. When I checkout the latest  packages the recent change to bool from int , emsdk
cause emscripten compilation to fail (From what I gather on the nimlang side). So Im sure now this is likely an issue with either nimland or nico(the nimlang game engine im using).

Initially reverting the change from bool back to int fixed everything. Since that didnt feel right to me the only other way I could get it to stop complaining was by adding the following to nim and nico: 


Those fixes look about right to me.

Apologies for the breakage,  that type of other-language binding did not occur to me when I made the int->bool change a while back.



Reply all
Reply to author
Forward
0 new messages