I have ported a DLL from Delphi Prism (version of Delphi, .Net with Pascal-like syntax) to C#. When my C#-based DLL is loaded from the application build in Delphi, the error arises:
Uncaught Exception: System.MissingMethodException: Method not found: "Void ClimateControl.TClimateData..ctor()".
in DriverBoardTest.ConsoleApp.Main(String[] args)
The data structure TClimateData used to be declarer in Delphi-code like this:
TClimateData = public record
public
tempSensor:Double;
tempHeater:Single;
humidity:Double;
end;
In C# it was converted to a struct:
public struct TClimateData
{
//public TClimateData() { }
public double tempSensor;
public float tempHeater;
public double humidity;
}
The decompiler (JetBrain dotPeak) added a constructor with the empty implementation, but apparently it is not allowed in C#, so I deactivated it.
If I try to convert the struct to a class with a default constructor, I get another error:
Uncaught Exception : System.TypeLoadException: The type "ClimateControl.TClimateData"
in the Assembly "SHT3xTest, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null"
can't be loaded due to a type conflict
in DriverBoardTest.ConsoleApp.Main(String[] args)
I think, the Delphi based DLL call the default constructor of the record which is not available when compiled with C#. Could I fix it?