David Schwartz 426 Posted November 4, 2020 (edited) Here's some code in a unit that compiles without error in a demo project (DX10.2): function TVCLSFTPClientDemoForm.ListingCallback(const names: Pfxp_names): Boolean; var StartRow,i:Integer; begin StartRow:=sgRemoteFiles.RowCount; sgRemoteFiles.RowCount:=StartRow+names.nnames; for i:=0 to names.nnames-1 do begin sgRemoteFiles.Cells[0,StartRow+i]:=Utf8ToString(names.names[i].filename); sgRemoteFiles.Cells[1,StartRow+i]:=DateTimeToStr(TTimeZone.Local.ToLocalTime(UnixToDateTime(names.names[i].attrs.mtime))); if names.names[i].attrs.permissions and $F000 = $4000 then sgRemoteFiles.Cells[2,StartRow+i]:='<dir>' else sgRemoteFiles.Cells[2,StartRow+i]:=IntToStr(names.names[i].attrs.size); end; When I paste this same code into another project that I created from scratch, I get errors saying "names.names is not an array" and it won't accept the [ i ] ]] subscript reference (square brackets apparently control italics). In fact, it's an array of pointers being returned from a DLL written in C/C++ where instead of using a subscript, it's probably using *p++ to iterate through the list. Here's how the data structures are defined: fxp_attrs=record flags:TUnsignedLong; size: UInt64; uid,gid, permissions, atime,mtime:TUnsignedLong; end; Pfxp_attrs=^fxp_attrs; fxp_name=record filename,longname:PAnsiChar; attrs:fxp_attrs; end; Pfxp_name=^fxp_name; Tfxp_name_array=array[0..20000000] of fxp_name; Pfxp_name_array=^Tfxp_name_array; fxp_names=record nnames:Integer; names:Pfxp_name; end; Pfxp_names=^fxp_names; I can't help but think this is probably a compiler flag somewhere. Any ideas? Edited November 4, 2020 by David Schwartz Share this post Link to post
David Schwartz 426 Posted November 4, 2020 (edited) 3 hours ago, FPiette said: {$POINTERMATH ON} ? Well, that's at the top of the 2 files with this code in it, so it looks like the culprit. I'll give it a try. Yup, that solved it. Thanks! Edited November 5, 2020 by David Schwartz 1 Share this post Link to post