在C程序中有这么一句:
mgc_mem_cpy((U8bit *)p_clh_msg->data,(U8bit *)p_data,data_len);
就是把p_data中的内容拷贝到p-clh_msg->data中去,我用D7改的:
CopyMemory((p_clh_msg^.data),p_data,data_len);
运行在这老报错。
在C中,U8bit是unsigned char, p_data是void *,data_len是长度。
在D中,我定义如下:p_data是pointer.
是不是在D7中也应该把指针的类型转化下?请问怎么转换指针类型呢?谢谢,谢谢,谢谢啦!

解决方案 »

  1.   

    CopyMemory(Pointer(p_clh_msg^.data),p_data,data_len); 
      

  2.   

    p_clh_msg在C里的定义:mgc_clh_msg_st *p_clh_msg;typedef mgc_ccm_msg_st mgc_clh_msg_st;typedef struct
    {
       gw_msg_hdr_st      hdr;
       mgc_ccm_hdr_st    ccm_hdr;
       U8bit             data[1];} mgc_ccm_msg_st;
    typedef struct
    {
       U32bit  trans_id;} mgc_ccm_hdr_st;typedef struct
    {
        U32bit      call_ref_id;
        U16bit      orig_task_id;
        U16bit      dest_task_id;
        U16bit       msg_id;  /* needs to be changed to U16bit or gw_msg_id_t */
        gw_boolean_t ack_required;
        U8bit       priority;
        U16bit      length;
       U8bit       endian;  /* 0 indicates BIG_ENDIAN and 1 indicates LITTLE_ENDIAN */ 
       gw_boolean_t call_trace_enabled; /* indicate if call trrace is enabled or not */   
    }gw_msg_hdr_st;类型我都在转成的D7的了。
      

  3.   

    二楼:ysai 
    你这样写CopyMemory(Pointer(p_clh_msg^.data),p_data,data_len)不行,我试了。
    写成这样可以CopyMemory(@(p_clh_msg^.data),p_data,data_len)