How can I write this in Delphi code?
[DllImport("FT_ND_API.dll")]
public static extern uint epas_CreateContext(out IntPtr hContextHandle,
uint ulFlags, uint ulApiVersion);
[DllImport("FT_ND_API.dll")]
public static extern uint epas_OpenDevice(IntPtr hContextHandle,
uint ulQueryType, IntPtr pQueryData);
[DllImport("FT_ND_API.dll")]
public static extern uint epas_GetProperty(IntPtr hContextHandle, uint ulFlags,
IntPtr pRefData, byte[] pPropData, uint ulPropSize);
[DllImport("FT_ND_API.dll")]
public static extern uint epas_CreateDir(IntPtr hContextHandle, uint ulFlags,
String pucName, String pucGuid, ref WDirInfo pDirInfo, uint ulSizeOfDirInfo);
Like this:
Notes:
IntPtris a pointer sized integer. In Delphi that isNativeInt.uintis an unsigned 32 bit integer,Cardinalin Delphi.stringgets marshalled to a C string, pointer to null-terminated string. Since there is noCharSetspecified, the default ofCharSet.Ansiis used. That’sPAnsiCharin Delphi.CallingConventionis specified so the default ofCallingConvention.StdCallapplies. So, that’sstdcallin Delphi.byte[]is an array of bytes. That’s marshalled as a pointer to the first byte of the array. So,PBytein Delphi.WDirInfoto Delphi. It looks like it might be a struct.You might be better off working from the C++ header file rather than the p/invoke declarations. It’s always best to work from the original source of an interface definition.