Thanks! that works as advertised.

On Friday, September 14, 2018 at 7:03:54 AM UTC-5, Floh wrote:
>
> Oh wait, I misread your post (but I answered it anyway by accident).
>
> EMSCRIPTEN_KEEPALIVE is what you're looking for :)
>
> On Friday, 14 September 2018 14:02:42 UTC+2, Floh wrote:
>>
>> Yes there is, check out the EM_JS macro: 
>>
>>
>> https://kripken.github.io/emscripten-site/docs/api_reference/emscripten.h.html#defines
>>
>> It's relatively new, but EM_JS together with it's counterpart 
>> EMSCRIPTEN_KEEPALIVE is all that's needed for some really sweet C/JS 
>> interop :)
>>
>> Here's an example of how I'm using it (it's especially nice for 
>> self-contained header-only libs, since the whole point of those is not 
>> requiring build system "intervention"):
>>
>>
>> https://github.com/floooh/sokol/blob/5bc682c6661b7a247957a5a81cceb86f3ea24a12/sokol_app.h#L1599-L1622
>>
>> Cheers,
>> -Floh.
>>
>> On Thursday, 13 September 2018 22:44:23 UTC+2, Joe Bibbo wrote:
>>>
>>> Is there a way to decorate a function, possibly with some 
>>> emscripten macro, so that the C functions are exposed to the JS?
>>>
>>> I am aware that I can add the function name to compile/link switch '
>>> EXPORTED_FUNCTIONS
>>>
>>> But I was hoping I could do it in code.
>>>
>>> Regards,
>>> Joe
>>>
>>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to