[Pas2js] How to pass an unknown record to a function as argument?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jun 15 16:07:07 CEST 2020


On Mon, 15 Jun 2020 05:49:46 -0700 (MST)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:

>[...]
> type
>   JRec = record
> 
>   end;
> 
>   TProcColumnNameParams = procedure(columnName: @record);
> 
> Of course this not work, I want to write a function and allow the
> user of the function to pass a record that I do not know in advance. 
>
> Then, the idea is to show the columnNames (code autocompletion) of an
> unknown DB table.
> 
> How to pass an unknown record to a function as argument?

You can pass any record to untyped, pointer, JSValue and TJSObject:

procedure Run(var r; p: Pointer; j: JSValue, o: TJSObject);

var a: JRec;
Run(a, at a,a,a);

Mattias


More information about the Pas2js mailing list