About Struct IUnityInterfaces in Low-Level-API tranform to Delphi

Somebody can help me to transform this code to Delphi:

typedef struct IUnityInterfaces
{
    // Returns an interface matching the guid.
    // Returns nullptr if the given interface is unavailable in the active Unity runtime.
    IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid);

    // Registers a new interface.
    void (UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface* ptr);

#ifdef __cplusplus
    // Helper for GetInterface.
    template <typename INTERFACE>
    INTERFACE* Get()
    {
        return static_cast<INTERFACE*>(GetInterface(GetUnityInterfaceGUID<INTERFACE>()));
    }

    // Helper for RegisterInterface.
    template <typename INTERFACE>
    void Register(IUnityInterface* ptr)
    {
        RegisterInterface(GetUnityInterfaceGUID<INTERFACE>(), ptr);
    }
#endif
} IUnityInterfaces;

/////////////////////////////////////////////////////////////////////////////////////
I try to transform like this:

type
  PUnityInterfaces = ^TUnityInterfaces;

  TUnityInterfaces = Object //clase(TInterfacedObject)
  public
    UnityInterface: IUNkNOWN;
   //queryInterface
   //RegisterInterface
   function Get(Guid:TGUID):IUnityGraphics;
   procedure Register(Guid:TGuid;_inf Pointer);
end;

then i load Func :

procedure UnityPluginLoad(unityInterfaces: PUnityInterfaces); stdcall

always addr error!
Why???

Use code tags…

Otherwise your post is really difficult to read.

2 Likes

the code list have not i want ,C++ & Delphi to choise;

ok, still use the tags with just CSharp selected.

It’ll still look better than no tags.

yes,really look better,thanks!