I need to invoke the c++ library method in c# but after trying different variations still it returns an error code -2 saying that it is a bad parameter.
Here is the C++ representation of the structure that needs to be passed in as parameter:
#define ATT_MAX_USER_INFO 129
typedef struct ATTUserToUserInfo_t
{
ATTUUIProtocolType_t type;
struct
{
short length; /* 0 indicates no UUI */
unsigned char value[ATT_MAX_USER_INFO];
} data;
} ATTUserToUserInfo_t;
typedef enum ATTUUIProtocolType_t
{
UUI_NONE = -1, /* indicates not specified */
UUI_USER_SPECIFIC = 0, /* user-specific */
UUI_IA5_ASCII = 4 /* null-terminated ASCII
* character string */
} ATTUUIProtocolType_t;
/*
* ATTMakeCallConfEvent - Service Response Private Data
* (private data version 5 and later)
*/
and following is the c# representation i have created for it:
public struct ATTUserToUserInfo_t
{
public ATTUUIProtocolType_t type;
public data data;
};
public struct data
{
public short length;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = ATT_MAX_USER_INFO)]
public byte[] value;
};
and following is the interop method call which needs to be invoked:
[DllImport("ATTPRV32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern Tsapi.Acs.RetCode_t attV6MakeCall(
[In, Out]
PrivateData_t privateData,
ref Csta.DeviceID_t_String destRoute,
bool priorityCalling,
ref Tsapi.Att.ATTUserToUserInfo_t userInfo);
Can someone please confirm if the ATTUserToUserInfo_t
is correctly represented in C# so that it can be marshalled to the c++ library side as parameter ?