I am trying to understand how line pointers work. I have a code (not quite original) that was written by someone, and there is no person here, so I need to understand the idea of such a use.
var
STR: string;
pStr: ^string;
begin
STR := 'Hello world';
New(pStr);
pStr^ := STR;
PostMessage(Handle, WM_USER+1, wParam(pStr), 0);
end;
Now I know for sure that the message handler receives the message, and the pointer contains a line with which to work, but what happens “under the hood” of these operations ?
I tried to make a small project. I thought that assigning a string to what the pointer to str points to would actually increase the refcount of the original string and not make any copies of the string, but refcount remained 1, and it looks like it copied the contents.
, , ? New , ?
refcount/length , PChar(@pStr^[1])[-8], (14), .
, questioin, , Windows?