On Thu, Mar 23, 2023 at 9:20 AM Thaina Yu <thain...@gmail.com> wrote:

> Thank you very much. Are there any public discussion or roadmap to
> add EM_ASM_REF into emscripten?
>

You are the first person that I know of to suggest it.

Be aware that using externref directly in C/C++ is very limited, even after
the recent changes.  For example you can't store them in structs or class
or store them to memory.  All you can really do with them is pass them
around and (maybe) put them in tables.  So in practice I'm not sure how
useful this stuff is yet, but I could be wrong?




>
> On Thursday, 23 March 2023 at 23:17:52 UTC+7 s...@google.com wrote:
>
>> On Thu, Mar 23, 2023 at 6:52 AM Thaina Yu <thai...@gmail.com> wrote:
>>
>>> Do we have anyway to write hand-written assembly code along with
>>> emscripten? And is it possible to return that externref from wasm code into
>>> emscripten world?
>>
>>
>> Here is the example how to use externref in assembly:
>> https://github.com/emscripten-core/emscripten/blob/main/test/core/test_externref.s
>>
>> Until recently there was no way to communicate those references directly
>> to C++ but it maybe possible now that upstream clan support has landed.
>>
>> There is no current support for externref in EM_ASM.   We could
>> potentially add EM_ASM_REF which returns a ref to C/C++ but until recently
>> that would have been impossible.
>>
>>
>>> I am actually using unity which use emscripten to build webgl. Would it
>>> possible to use EM_ASM_PTR to write wasm code to return as pointer
>>> (externref ? (an so I might return pointer as IntPtr in C#)) ?
>>>
>>> On Friday, 17 March 2023 at 22:35:55 UTC+7 tli...@google.com wrote:
>>>
>>>> Yes, but note that the usage in that commit is only in hand-written
>>>> assembly code, not in C/C++.
>>>>
>>>> More recently, support for externref landed upstream in clang:
>>>> https://github.com/llvm/llvm-project/blob/main/clang/test/CodeGen/WebAssembly/wasm-externref.c.
>>>> AFAIK we haven't yet experimented with it in Emscripten, but in principle
>>>> it should work.
>>>>
>>>> On Fri, Mar 17, 2023 at 10:23 AM Thaina Yu <thai...@gmail.com> wrote:
>>>>
>>>>> Is this mean externref already usable?
>>>>>
>>>>> https://github.com/emscripten-core/emscripten/pull/15913
>>>>>
>>>>> On Monday, 10 October 2022 at 22:56:34 UTC+7 karl.we...@gmail.com
>>>>> wrote:
>>>>>
>>>>>> Does anyone have news on this topic?
>>>>>>
>>>>>> tli...@google.com schrieb am Montag, 25. Januar 2021 um 19:51:36
>>>>>> UTC+1:
>>>>>>
>>>>>>> I don't think so, but you can keep an eye on commits from "wingo"
>>>>>>> and "pmatos" on reviews.llvm.org to keep track of the progress.
>>>>>>>
>>>>>>> On Mon, Jan 25, 2021 at 12:55 AM ben layet <lay...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Thanks!
>>>>>>>> Is there a feature ticket in a publicly visible ticket tracker that
>>>>>>>> I can keep an eye on?
>>>>>>>> cheers
>>>>>>>> ben
>>>>>>>>
>>>>>>>> On Saturday, 23 January 2021 at 17:54:25 UTC tli...@google.com
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Not yet, but there are some folks working on this. Perhaps it will
>>>>>>>>> be ready to use in a few months? It’s hard to say for sure.
>>>>>>>>>
>>>>>>>>> On Sat, Jan 23, 2021 at 03:49 ben layet <lay...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Does emscripten support externref reference types for holding
>>>>>>>>>> opaque handles to JS objects in C++? If not, any idea when?
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> 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 on the web visit
>>>>>>>>>> https://groups.google.com/d/msgid/emscripten-discuss/7f6178fa-bd05-4f65-aa7c-9e5a405bf851n%40googlegroups.com
>>>>>>>>>> <https://groups.google.com/d/msgid/emscripten-discuss/7f6178fa-bd05-4f65-aa7c-9e5a405bf851n%40googlegroups.com?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-disc...@googlegroups.com.
>>>>>>>>
>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/emscripten-discuss/68c9b121-f12f-44fa-a91c-2a8b73d2f456n%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/emscripten-discuss/68c9b121-f12f-44fa-a91c-2a8b73d2f456n%40googlegroups.com?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-disc...@googlegroups.com.
>>>>>
>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/emscripten-discuss/57b1491a-7025-4967-a66e-ebcbf10f5e2bn%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/emscripten-discuss/57b1491a-7025-4967-a66e-ebcbf10f5e2bn%40googlegroups.com?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-disc...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/emscripten-discuss/ed80516b-e1ac-4ba1-a535-acd1f632a2f5n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/emscripten-discuss/ed80516b-e1ac-4ba1-a535-acd1f632a2f5n%40googlegroups.com?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 on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/e4853c85-e981-4fa4-a6d8-f64a7ad5c048n%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/e4853c85-e981-4fa4-a6d8-f64a7ad5c048n%40googlegroups.com?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 on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-PsXhL7ZRA8q7t%3D79z_qZ%2BC1EdFv-bOybh63g_%2B8L_sg%40mail.gmail.com.

Reply via email to