How to use in C# function from Win32 DLL file made in Delphi. When function parameters are custom delphi objects?
Function definition in Delphi:
function GetAttrbControls( Code : PChar;
InputList: TItemList;
var Values : TValArray): Boolean; stdcall; export;
Types that use:
type
TItem = packed record
Code : PChar;
ItemValue: Variant;
end;
TItemList = array of TItem;
TValArray = array of PChar;
Example in C# (doesn't work):
[StructLayout(LayoutKind.Sequential)]
public class Input
{
public string Code;
public object ItemValue;
};
[DllImport("Filename.dll", EntryPoint = "GetValues", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool GetValues(string Code, Input[] InputList, ref StringBuilder[] Values);