ASP.NET调用VC6 Dll并返回值问题
VC Dll内接口
extern "C" _declspec(dllexport) LPCTSTR WINAPI ComInterface(char* command, char* commandArgument)
{
CString Data;
………………
return Data;
}
ASP.NET调用
[DllImport("xxxx.dll")]
public static extern string ComInterface(string a, string b);
string a,b;
…………
string GetData = ComInterface(command, argument);
结果:有时候能正确返回值,有时候会出现异常:Attempted to read or write protected memory. This is often an indication that other memory is corrupt.即使返回值是一样的也有时正确,有时异常,请问是什么原因,该如何解决?
另:VS2005和VC6.0如何联调程序,如上面这个程序,我希望能在ASP.NET调用DLL时调试DLL,我在VC6中将Debug目录设成VS2005的路径,在DLL设了断点,调试DLL时vc6启动了VS2005,选择调用了该DLL的程序,但运行时不会进入DLL,请问如何设置?