errors in making standalone program using matlab 2013b
3 views (last 30 days)
I was using matlab 2013b and Matlab Compiler Runtime 2013b to make a standalone program. Matlab can successfully generate an executable but when I run it I got "The procedure entry point ?deallocate_via_handler_v3@internal@tbb@@YAXPAX@Z could not be located in the dynamic link library tbb.dll." I tried different codes and got the same error. Any thoughts on the tbb.dll error?
My operating system is Windows 7 professional. I tried both 32 bit and 64 bit matlab and MCR but none of them worked out.
Thanks in advance, Yubo
Peter on 4 Apr 2014
Hi Yubo, I encountered the same problem as you described. Yust copy the tbb.dll (C:\Program Files\MATLAB\R2013b\bin\win64\tbb.dll) to the folder where your executable is and the problem is solved.
More Answers (2)
Martijn on 22 Aug 2014
Errors like the one shown above occur when an application encounters a different tbb.dll version than expected. So the important question to ask here is why does an application (or a MATLAB Compiler Standalone in particular here) encounter a different tbb.dll version than expected?
To be able to answer this it is first important to know how the Dynamic-Link Library Search Order works. Basically whenever an application tries to load a DLL, Windows will look for this DLL in the following locations in the following order (I only list the locations relevant for this discussion):
- The directory from which the application loaded.
- The Windows\System32 directory.
- The Windows directory.
- The current directory.
- Directories on the PATH environment variable.
Now both MATLAB and the MCR "try to be nice". They include tbb.dll in their bin\$arch directories which by default is not added to PATH and which obviously is also not the Windows(\System32) directory. So basically they cannot influence other applications.
Further when you run normal MATLAB through bin\matlab.exe this will underneath run bin\$arch\matlab.exe. So for MATLAB itself, tbb.dll is immediately found on "1. The directory from which the application (bin\$arch\matlab.exe) is loaded". So here nothing can go wrong.
For a MATLAB Compiler Standalone however this story is different. A standalone basically starts with loading mclmcrrtM_N.dll and this should be found on "5. Directories on the PATH" (MCR\runtime\$arch directory in this case). It then determines where bin\$arch is (relative to the location of mclmcrrtM_N.dll) and it adds this directory to the front of PATH (for the current application only, not the system wide setting). Then at a later point when tbb.dll gets loaded this is resolved in the following way:
- "The directory from which the application loaded." for a standalone this is the location containing yourStandalone.exe (which is not the MCR\bin\$arch directory). So by default tbb.dll is not found here. As suggested by Peter though you can place a manual copy here of the right version (the one included with MATLAB/MCR) to work around issues which could occur in the further steps.
- "The Windows\System32 directory." For things to work correctly tbb.dll should not be found here. Some other ("less nice" in terms of not trying to influence other applications) application may have decided to place a tbb.dll here though. In that case your standalone will get to see this tbb.dll. If that is an different version this can lead to the errors. (Note the emphasis on if, only if this is a different version an error can occur which may explain why things worked fine in R2013b but R2014a needed a workaround for "Image Analyst"). If you encounter an incorrect tbb.dll here you can consider removing this DLL such that the search continuous below or as mentioned under 1 place a correct copy next to the standalone.exe to prevent ever even getting to this point.
- The Windows directory. Basically the same story as the previous point. tbb.dll should not be found here but it could happen.
- "The current directory" often equal to "The directory from which the application loaded." but not necessarily so. This one hardly ever causes an issue though. But again tbb.dll should normally not be found here.
- "Directories on the PATH environment variable." now here tbb.dll should be found, more specifically in MCR\bin\$arch which the standalone added to its PATH at startup. (Note that PATH really is the last thing which is looked at which may explain why Ralph's approach did not work, he probably encountered a tbb.dll in Windows\System32).
Image Analyst on 6 Feb 2014
There are known problems/errors/bugs/issues with tbb.DLL and the MATLAB R2013b compiler, at least for the Image Acquisition Toolbox. 'tbb.dll' is part of Intel's Threading Building Blocks library. You need to put tbb.dll in the same folder where your executable resides. There are a few other things that might be required also. Call them and tell them about the tbb.dll bug, and they can email you full directions for the workaround/fix.