MapDll.dll中有一个函数
int __stdcall map(string arr[])
{
    string temp[] = {"yes", "no"};
    arr[0] = "yes";    // right
    arr[0] = temp[0];  // error
}
exe中:
string arr[] = {"no", "yes"};
.....
error的那种赋值方式会报错,请指点,谢谢!

解决方案 »

  1.   

    包含了:
       #include "string.h"
      吗?
      

  2.   

    包含了
      #include <string>赋值字符串常量没问题
    可能是跟 exe 中的内存分配 和 dll 中的内存分配有关系
      

  3.   

    string temp[] = {"yes", "no"};
        arr[0] = "yes";    // right
        arr[0] = temp[0].c_str(); // 此处有修改是此处的temp数组的析构造成的,用c_str()直接调用string 的operator=().
      

  4.   


    To: superlym2005()
        你说这种方法是对的,但你的解释我还不是很理解,什么时间有空的话,麻烦解释详细点好吗?谢谢!
      

  5.   

    用std, 还把函数名字改成 map,
    出错都是活该
      

  6.   

    To: iicup(双杯献酒) ( ) 
         哥们很细心呀,骂的好,呵呵。