MATLAB dll in Visual C++

1 次查看(过去 30 天)
dequan
dequan 2018-2-11

matlab function

if true
  function [c] = myfittest(x, y)
 c=x+y;
 return;
end  
i have test vs2013(64bit) and matlab2015a(64bit) ,matlab2017a(64bit)
if true
 int main(int argc, char *argv[])
{
	int a = 4;
	int b = 3;
	int c;
	if (!myfittestInitialize())  //初始化库文件,在.h文件中有定义,Mytest为生成文件名
	{
		cout << "Mytest Initialize failed!" << endl;
		return 0;
	}
	mwArray mwa(1, 1, mxUINT32_CLASS);  //给输入参数A赋值
	mwa.SetData(&a, 1);
	mwArray mwb(1, 1, mxUINT32_CLASS);  //给输入参数B赋值
	mwb.SetData(&b, 1);
	mwArray mwy(1, 1, mxUINT32_CLASS);
	myfittest(1, mwy, mwa, mwb);  //调用test函数,该函数在.h中有定义
	//第一个参数:.m文件中test函数对应的输出参数个数
	//第二个参数:.m文件中test函数对应的输出参数C
	//第三个参数:.m文件中test函数对应的输入参数A
	//第四个参数:.m文件中test函数对应的输入参数B
	mwy.GetData(&c, 1);  //获取test计算结果C
	cout << c << endl;
	myfittestTerminate(); //结束end 在.h中有定义
}
end
i meet that

</matlabcentral/answers/uploaded_files/104361/QQ%E5%9B%BE%E7%89%8720180211193931.png> but i can insert this to the enviroment variables

</matlabcentral/answers/uploaded_files/104362/QQ%E6%88%AA%E5%9B%BE20180211195847.png> and i meet this

</matlabcentral/answers/uploaded_files/104363/QQ%E6%88%AA%E5%9B%BE20180211200236.png> when i insert all the mclmcrrt9_2dll and mclmccrt8_5dll i can not myfittestInitialize()!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Code Generation, GPU, and Third-Party Support 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!