{*******************************************************}
{                                                       }
{       Pascal Script Source File                       }
{       Run by RemObjects Pascal Script in CnWizards    }
{                                                       }
{       Generated by CnPack IDE Wizards                 }
{                                                       }
{*******************************************************}

program PtrDemo;

uses
  Windows, Messages, SysUtils, Classes;

// Pascal Script doesn't support Pointer directly,
// so we declare Pointer as Cardinal.

var
  P: Pointer;

begin
  // GetMem and FreeMem is supported.
  // Once you alloc a memory block, you must free it finally.
  GetMem(P, 16);
  try
    _SetByte(P, 1);
    _SetByte(P + 1, 2);
    _SetByte(P + 2, 3);
    _SetByte(P + 3, 4);
    Writeln(Format('0x%x', [_GetInteger(P)]));
  finally
    FreeMem(P);
  end;
end.

