Definicija funkcije:
Code:
function GetAttrbControls( Code : PChar;
InputList: TItemList;
var Values : TValArray): Boolean; stdcall; export;
function GetAttrbControls( Code : PChar;
InputList: TItemList;
var Values : TValArray): Boolean; stdcall; export;
Definicija tipova:
Code:
type
TItem = packed record
Code : PChar;
ItemValue: Variant;
end;
TItemList = array of TItem;
TValArray = array of PChar;
type
TItem = packed record
Code : PChar;
ItemValue: Variant;
end;
TItemList = array of TItem;
TValArray = array of PChar;
Trebalo bi da je nekako ovako, ali nešto je pogrešno:
Code:
[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);
[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);