Objective-C to Delphi : bug?


I have this protocol:

@protocol Once <NSObject>

And I translate it to

Once = interface(IObjectiveC)

then I have this function :

FOUNDATION_EXTERN id <Once> __nullable CreateOnce(void) API_AVAILABLE(macos(10.11), ios(8.0)) NS_RETURNS_RETAINED;

that I translate to

function CreateOnce: Once; cdecl; external libOnce name _PU + ‘CreateOnce’;

The problem is that CreateOnce always returns me nil!

If I translate it to

function CreateOnce: POINTER; cdecl; external libOnce name _PU + ‘CreateOnce’;

so I replace Once by POINTER then it’s work! Any idea why ?

Also how can I convert a pointer to a Once object (Once = interface(IObjectiveC))?

Comments are closed.