Use compiled Mex file from a different machine
4 次查看(过去 30 天)
显示 更早的评论
I am using the compiled Mex files provided by my team member. I can call the API without any problem. However, if I call the same API twice, with the exact same input, I get different output with some random noise added.
My team member who compiled the C code runs the same thing on his computer, and he does not see the problem. Do I have to compile the C to Mex it on my own machine?
Thanks
1 个评论
Jan
2017-8-21
Which "API" do you mean? What do you call twice? Without seeing any line of the code or knowing any detail of the problem, it is impossible to suggest a solution.
采纳的回答
Walter Roberson
2017-8-21
The most probable cause for an error like you describe is that there is a pointer dereference to memory that does not belong to the variables nominally being accessed. Those kinds of errors can result in the program appearing to work for someone but crashing badly for someone else running exactly the same binary, who happens to call it at a different life-cycle of their own code where the other variables are laid out differently, tickling a crash.
Compiling the code on your own machine typically makes little to no difference for problems such as these -- unless, that is, you happen to have a compiler environment that does a better job of detecting bad pointers.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!