[DllImport("CMPPAPI.dll")]
public static extern int CMPP_Submit(
int conn_id,
ulong p_msg_id, //ref ulong
ulong msg_level,  //byte
string service_id, //byte[]
ulong msg_format, //byte
string msg_src,  //byte[]
string fee_type,  //其他的自己改吧
string fee_code,
string valid_time,
string at_time,
ulong tp_pid,
ulong udhi,
ulong fee_user_type,
string charge_mobile,
string src_mobile,
ulong user_num,
string dest_mobiles,
string msg,
int msg_len,
ulong need_response
);

解决方案 »

  1.   

    char* 是否應該用 string 代替呢?
      

  2.   

    conn_id 是不是應該用 INT64 呢?
      

  3.   

    還有 int* 應該用 ref int 代替.
      

  4.   

    char* 用string代替是可以的,这个通过此API的其他函数已经验证了。本例中,只有四个类型
    int、INT64 *、unsigned char、char *(C),分别在C#中使用int、ref ulong、byte、string与之对应,这个还有问题吗? [DllImport("CMPPAPI.dll")]
    public static extern int CMPP_Submit(
    int conn_id,
    ref ulong p_msg_id,
    byte msg_level,
    string service_id,
    byte msg_format,
    string msg_src,
    string fee_type,
    string fee_code,
    string valid_time,
    string at_time,
    byte tp_pid,
    byte udhi,
    byte fee_user_type,
    string charge_mobile,
    string src_mobile,
    byte user_num,
    string dest_mobiles,
    string msg,
    int msg_len,
    byte need_response
    );
    但是在引用过程中还是会出错。