Use compiled Mex file from a different machine

4 views (last 30 days)
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 Comment
Jan
Jan on 21 Aug 2017
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.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 21 Aug 2017
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.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!