[Gambas-user] Does anyone have any thoughts on webassembly

Jussi Lahtinen jussi.lahtinen at gmail.com
Fri Aug 5 02:59:49 CEST 2022


You are right. Gambas JIT does not make standalone C code, it is heavily
dependent on the interpreter. I don't think there is an easy way to compile
even a skeleton version of Gambas into WebAssembly. WebAssembly makes
restrictions on what the code can do and for example not all libraries are
available. IE you cannot even compile just an arbitrary C program into
WebAssembly, you need to design it to be used so.

Jussi



On Fri, Aug 5, 2022 at 3:09 AM Yves Cloutier <yves.cloutier at gmail.com>
wrote:

> I'm not an expert on the subject but i think you would need the gambas vm
> or runtime to be compiled to web assembly. Like pyscript for example an
> entire python runtime is loaded in the browser i believe.
>
> On Thu, Aug 4, 2022, 18:43 Brian G <brian at westwoodsvcs.com> wrote:
>
>> Webassembly is a virtual machine inside the web browser that is now
>> supported by most browsers. It allows a c program to be compiles to web
>> assembly
>> Then run on the web assembly virtual machine.
>>
>> Most compilers now have a webassembly translator or compile directly to
>> web assembly.
>> Since when a gambas module is fast it is translated to c code and then
>> compiles to native machine code. Perhaps it would be possible compile to
>> web assembly which could be directly sent to the client browser for
>> execution.
>>
>> It would mean I think that all gambas modules would have to be compiled
>> to web assembly library format.
>>
>> web assembly links all required code and libraries to a single app binary
>> I think and then sends it to the browser and runs in in a sandboxed virtual
>> machine.
>>
>> Not sure what else. But it would be quite useful. To write to the app and
>> it just runs on the clients machine in the browser.
>>
>> --
>> Thanks
>> Brian G
>> Thursday, 04 August 2022, 00:08PM -07:00 from Rolf-Werner Eilert
>> rwe-sse at osnanet.de:
>>
>>
>> Am 04.08.22 um 18:57 schrieb Brian G:
>>
>> Has anyone tried or have any thoughts on having gambas fast unsafe
>> produce webassembly on the back end for running inside browsers.
>> I understand there is a c to webassembly compiler available.
>> Not sure what would be involved.
>> Any thoughts?
>>
>> --
>> Thanks
>> Brian G
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>>
>> I just read an article about PyScript and/or Pyodide and thought this
>> might be interesting for Gambas, too. Do you mean something like that?
>>
>> Regards
>>
>> Rolf
>>
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220805/c5cce74c/attachment.htm>


More information about the User mailing list