如int mysum( int a , int b ) 
{
 a = a+ b ; 
return a + b ; 
}在函数调用完毕之后, 
仍然想得到a  
在函数调用之后改变的值 
该如何处理此问题

解决方案 »

  1.   

    HINSTANCE h_dll; 
    unsigned char  sn2[50];
    unsigned char* sn3;
    unsigned char sn4;
    sn3 = (unsigned char*)malloc(sizeof(unsigned char) * 8 ) ;  CString cardsn ; 
    typedef int (__stdcall * rd)(unsigned char*);
    rd r;
    int err,st;  h_dll = LoadLibrary("CCARD.dll");
    if ( h_dll == NULL)
    {
    err = ::GetLastError();
    this->MessageBox("载入动态库失败!");
    return ;
    } r = (rd)(unsigned char*)GetProcAddress(h_dll,"rd");
    if ( r == NULL) 
    {
    this->MessageBox("读取模块失败");
    return ; 
    };
    //sn2 = "1111111111";
    //memset(sn2,0,sizeof(sn3));
    st = 0 ;
    st = r(&sn4);
    if ( st == NULL | st == 0 )
    this->MessageBox("函数没有被执行"); cardsn = sn2; this->MessageBox(cardsn);
      

  2.   

    我的动态库中的函数是  int rd(unsigned char* sn );如果执行成功则返回 1 
    但是  SN  并不能回传 可不可以举一个简单的例子