C/C++ code
typedef   struct     _RESULT 

int   id; 
double   light; 
double   temperature; 
double   rh; 
}   RESULT; C/C++ 
void* GetResult()
{
RESULT result;
CZigbeeProtocol zigbeeProtocol;
    if (zigbeeProtocol.GetResult(m_recvData,result))   //此处的result就是前面提到的结构体
return   &result; 
} 程序中: C/C++ codetypedef   struct     _RESULT 

int   id; 
double   light; 
double   temperature; 
double   rh; 
}   RESULT; 
typedef void * (*dll_GetResult)(void *);
dll_GetResult GetResult=(dll_GetResult)GetProcAddress(hInstance,"GetResult");RESULT  * result=(RESULT*)GetResult(0); 
UpdateRecvResult(*result);
这样,程序调试不成功

解决方案 »

  1.   

    void*   GetResult() 

    RESULT   result; 
    CZigbeeProtocol   zigbeeProtocol; 
            if   (zigbeeProtocol.GetResult(m_recvData,result))       //此处的result就是前面提到的结构体 
    return       &result;   
    }   这样能成功才怪,早给你说了,这个里面要自己new的void*   GetResult() 

    RESULT   *result=(RESULT*)malloc(sizeof(RESULT)); 
             memset(result,0,sizeof(RESULT))
    CZigbeeProtocol   zigbeeProtocol; 
            if   (zigbeeProtocol.GetResult(m_recvData,*result))       //此处的result就是前面提到的结构体 
    return       result;   
      

  2.   

    还要请教楼上的
    typedef void * (*dll_GetResult)(void *);
    dll_GetResult GetResult=(dll_GetResult)GetProcAddress(hInstance,"GetResult");
    if (GetResult==NULL)
    {
    AfxMessageBox("寻找22Dll函数失败");
    }
    这儿为什么调用动态库不成功,明天上班给分。谢谢
    我初学。
      

  3.   

    dll里面导出的名字是不是这个?在导出函数前面要加上extern "C",或使用def文件导出
      

  4.   

    或通过参数返回:
    void GetResult(RESULT& result)
    {
        CZigbeeProtocol zigbeeProtocol;
        zigbeeProtocol.GetResult(m_recvData,result);       //此处的result就是前面提到的结构体
    }  
      

  5.   

    DLL 导出函数定义extern "C" _declspec(dllexport) void * GetResult(void * );
      

  6.   

    在没,我想请教下,怎样将一个dll中的某个非内置类型的全局对象import到另一个dll中?谢谢