"Internal problem" when running a MEX file the second time
7 views (last 30 days)
Show older comments
Hi, I am having a problem when trying to run a .mexmaci64 file written by C++ with OpenCV the second time. I really appreciate if someone could help me.
Here is the test I did: I created a .dylib by C++ and some OpenCV stuff, and compiled it in the terminal with something like this:
g++ -dynamiclib Test.cpp -fvisibility=hidden -o libTest.dylib `pkg-config --cflags --libs opencv`
Then, in the mexFunction, I loaded this .dylib and did nothing else. It could run properly the first time, but Matlab popped up a window saying "Matlab encountered a internal problem... bla bla" when I ran it the second time.
I think it's because the dylib with OpenCV couldn't be loaded properly the second time, since I tried the same thing without the OpenCV stuff and everything is fine.
Does anyone know how to solve this? Thank you!
0 Comments
Answers (1)
Ken Atwell
on 18 Jun 2012
Does the OpenCV library have a "close" function or something similar to call before the library is unloaded? Assuming there is, you could call this as the last operation in Test.cpp.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!