Skip to content

Dynamic Method Not Support? AV occured. #275

Open
@cnpack

Description

@cnpack

We run this pascal script engine under x64 and register:

  with CL.AddClass(CL.FindClass('TObject'), TPersistent) do
  begin
    RegisterMethod('Procedure Assign( Source : TPersistent)');
    RegisterMethod('Function GetNamePath : string');  // this one
  end;

and

  with CL.Add(TPersistent) do
  begin
    RegisterVirtualMethod(@TPersistent.Assign, 'Assign');
    RegisterVirtualMethod(@TPersistent.GetNamePath, 'GetNamePath');
  end;

Then run a script like below:

program ScriptTest;

var
  P: TPersistent;
begin
  P := TPersistent.Create;
  Writeln(P.GetNamePath);
  P.Free;
end.

We'll get an AV:

Exception: Access violation at address 0000000000D8DECB in module 'ScriptTest.exe' (offset DECB). Read of address FFFFFFFFFFFFFF78

if under 32bit, AV also comes out .

Seems the reason is function GetNamePath: string; dynamic;

For dynamic functions, seems Pascal Script engine can not get it's correct entry address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions