Delphi and FPC have different language boundaries, so it is always good to read a thread discussing how to get near-the-edge cases work in both.
This case is about Smart Pointers (here called auto pointers, maybe because auto_ptr
is what they used to be called in C++): [WayBack] Hi all, I am trying to make a certain piece of code cross compile between Delphi and FPC. On FPC, it compiles fine but on Delphi I get a [dcc32 Error] P… – Ugochukwu Mmaduekwe – Google+
In the end if comes down to that Delphi does not allow forward-declaration of records (it does for interfaces and classes), but that you do not need a __PAutoPtr_T = ^__TAutoPtr_T
, because you can use ^__TAutoPtr_T
in parameters.
In Spring4D, they are called Shared
/IShared
/TShared
, see my comment:
Note that since these are reference counted, you might want to call them
shared_ptr
. If you enforce the single-instance behaviour, observe that in C++ they are now calleduniqe_ptr
.In Spring4D this rename has already taken place a while ago: https://bitbucket.org/sglienke/spring4d/commits/e252b81fd3788cf5b82588721f68d00c892deb87
–jeroen