[fpc-pascal] fpc webassembly and node

pas2js at gauns.org pas2js at gauns.org
Sun Oct 8 21:09:12 CEST 2023


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.


More information about the fpc-pascal mailing list