[fpc-pascal] fpc webassembly and node

Michael Van Canneyt michael at freepascal.org
Mon Oct 9 10:21:40 CEST 2023


Hello,

Either list is fine.

This should compile and work.

I'm using webassembly and classes quite a lot, even with threading, 
so I see no reason why this simple code should not run.

How did you start the webassembly ? 
How much memory did you provide to the webassembly ?
Did you use pas2js to start it ? What browser did you test ?

Michael.

On Sun, 8 Oct 2023, k1 via fpc-pascal wrote:

>
> Hi guys,
>
> i have a question concerning webassembly,
> please let me know if this is the wrong list.
>
> is it possible to use classes and compile to webassemly,
> the following code is working well but wen i uncomment the constructor line
> the code can be compiled but will not run anymore
>
> RuntimeError: memory access out of bounds
>
> is the result
>
> i compile with the following command
>
> ppcrosswasm32 -Twasi -oadd.wasm add.pas
>
>
> ------------
> library add;
>
> {$mode objfpc}
>
> type
>  TConnection = class
>  private
>    n : Integer;
>  public
>    constructor Create;
>  end;
>
> constructor TConnection.Create;
> begin
>  n := 4711;
> end;
>
> function add( a1, a2 : Integer ) : Integer;
> var
>  connection : TConnection;
> begin
>  //connection := TConnection.Create;
>  Result := 4711;
> end;
>
> exports
>  add name 'add';
> end.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>


More information about the fpc-pascal mailing list