C#调用VC dll 中有ref 参数出错
DLL为COM ,当工程引用后为
DLL的函数为 yhinit(ref object str);object str = null;
str ="";
 yhinit(ref str);
//这样提示内存已损坏。以前的DLL调用是ref 参数是CHAR * 时
DLL的函数为 yhinit(ref StringBuilder str);StringBuilder s = new StringBuilder(101);
a.append("");      
 yhinit(ref s );
//这样是能调用的我知道这是由没有给参数分配内存的原因,但如参数是ref object str怎么弄呢。