Remobjects structures do not get created in hydra


(marcantheunis) #1

How do you define a structure in a .NET plugin so it can be used by a delphi host?

With .NET code below I get my 2 interfaces but not a delphi definition for TInputRequestPack

[Guid(“58622C00-6389-491E-B691-7E9F49C18989”)]
[StructLayout(LayoutKind.Sequential)]
public struct TInputRequestPack
{
[MarshalAs(UnmanagedType.BStr)]
public string scanCode;
public bool allowInput;
public string cnk;
public string articleName;
public DateTime expDate;
}
[Guid(“3A3BAA02-635A-4BE2-90B1-E72AB56FC077”)]
public interface IWWKS2Communication : IHYCrossPlatformInterface
{
int add(int a, int b);
bool Connect(string host, int portnr);
int getState();
}
[Guid(“C6F6B410-D905-4DEE-AFBF-1ADE6AF7632F”)]
public interface IWWKS2PluginFeedback : IHYCrossPlatformInterface
{
int notifyStateChange(int newState);
int askInputRequest(ref TInputRequestPack pack);
}

result after import interface:

type
IWWKS2Communication = interface;
IWWKS2PluginFeedback = interface;

// Original Name: OffRobotWWKS2.IWWKS2Communication
IWWKS2Communication = interface(IHYCrossPlatformInterface)
[’{3a3baa02-635a-4be2-90b1-e72ab56fc077}’]
function add(const a: LongInt; const b: LongInt): LongInt; safecall;
function Connect(const host: WideString; const portnr: LongInt): WordBool; safecall;
function getState: LongInt; safecall;
end;

// Original Name: OffRobotWWKS2.IWWKS2PluginFeedback
IWWKS2PluginFeedback = interface(IHYCrossPlatformInterface)
[’{c6f6b410-d905-4dee-afbf-1ade6af7632f}’]
function notifyStateChange(const newState: LongInt): LongInt; safecall;
function askInputRequest(var pack: TInputRequestPack): LongInt; safecall;
end;


(antonk) #2

As expected. The recommended way of cross-platform interacting is via interfaces descended from IHYCrossPlatformInterface. It is possible to use structures but in this case it is up to you to define them Delphi-side. Plugin importer handles only interfaces (at least now).

I’ll log an issue to investigate if it is possible to manage structures as well.


(RemObjects) #3

Thanks, logged as bugs://80579