vc 调用带有输出值的画图功能dll后,matlab和vc之间参数怎么传递
void CMainFrame::OnButton32771()
{
// TODO: Add your command handler code here
// 这个程序的功能是调用由matlab生成的ppp3.dll画图,并返回字符串t1:判断是否画图成 // 功。最后显示t1。
ppp3Initialize();
mxArray *t0,*t,*t1;
CString s0="e:\\;BL_X;BL_T;BL_R;";
CString s="4,0.95,0.78,0.61,0.43,0,0,0,0,0,0,0,0,0,0,0,0,0,0";
t0=mxCreateString(s0);
t=mxCreateString(s);
t1=mlfBl_new(t0,t);
char *str=mxArrayToString(t1);
::AfxMessageBox(str);
//销毁t, 释放内存
mxDestroyArray(t0);
mxDestroyArray(t);
//注销动态链接库
ppp3Terminate();
}
编译连接均没错,运行后总报错:unhandled exception in bl1.exe(libmx.dll):0xC0000005;Access violation.
我察看了一下,是char *str=mxArrayToString(t1)有错,这一句是将matlab字符串转换为vc字符串。请教高手,怎么修改源程序呢?