mxCreateDoubleMatrix returns NULL when called from C program on a system using MCR
14 次查看(过去 30 天)
显示 更早的评论
Hi,
mxCreateDoubleMatrix returns NULL when called from a C/C++ console program? My system setup as such:
Win 7
Matlab 4.16
MCR 1.16
C shared library compiled by MATLAB Compiler 4.16 (R2011b)
I've linked the mclmcrrt.lib and <myCompiled m file>.lib and dll--not sure if more are required?
Thanks for your input.
0 个评论
回答(2 个)
Kaustubha Govind
2012-5-24
What arguments do you pass into mxCreateDoubleMatrix? If your applications compiles and links property, and doesn't have other run-time errors, I wouldn't worry about the .lib and .dll files. On the other hand mxCreateDoubleMatrix allocates memory on the heap, so one situation where it may return NULL is when your application is out of memory. You are trying to create a very large matrix perhaps? I would recommend try to use "new" to allocate the same amount of memory and see if it throws the bad_alloc exception.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 C Shared Library Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!