procedure TForm1.Button1Click(Sender: TObject);
type TByteArray=Array of Byte;
function GetStr:TByteArray;
begin
SetLength(Result,100);
StrPCopy(PChar(@Result[0]),'aaaaaaaaaaa');
end;
var B:TByteArray;
begin
B:=GetStr;
ShowMessage(Pchar(@B[0]));
end;