Using loadlibrary in deployed application on computer without matlab

7 views (last 30 days)
I need to load a dll using loadlibrary in a deployed GUI application. I have created a .m file to use the calllib function in a deployed application as recommended.
To get the application to work as deployed on even my computer (with Matlab installed) I had to run mex -setup and select the Lcc-win32 C 2.4.1 compiler. The application now runs fine on my computer but when I need to run it on a computer not running Matlab and not with the Lcc-win32 C compiler selected it fails.
How can I get around this?
  1 Comment
Geoff
Geoff on 2 May 2012
Have you installed the MCR on your target machine? It is required to run deployed apps.
Are you able to provide a more descriptive account of the issue instead of "it fails"?

Sign in to comment.

Answers (4)

Walter Roberson
Walter Roberson on 2 May 2012
Which MATLAB version are you using, on which OS? You are using the 32 bit version of MATLAB, right? And the target system, which OS version is it? Have you installed MCR on the target system?
  1 Comment
Krishan
Krishan on 2 May 2012
I am running the 32-bit MATLAB version 7.12.0.635 (R2011a) on Windows XP SP3.
The target system is a 32-bit Windows 7 that has MCR installed.

Sign in to comment.


Kaustubha Govind
Kaustubha Govind on 2 May 2012
If you are already using the prototype file (.m) for LOADLIBRARY, you don't need to have a C/C++ compiler installed. Try running your application from a command window (as opposed to simply double-clicking on the icon), and see what error is reported.

Krishan
Krishan on 2 May 2012
After running in a command window this is the error that occurs:
??? Error using ==> loadlibrary at 441
There was an error loading the library
%full library file name
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
Error in ==> panel>CALC_exportFCS at 1403
Caused by:
Error using ==> loaddefinedlibrary
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
??? Error while evaluating uicontrol Callback
I just assumed it was a result of the compiler not being selected. I'm not sure how to correct the side-by-side configuration.
  3 Comments
Walter Roberson
Walter Roberson on 2 May 2012
Did you bundle the library with the .exe ? If so then is the directory that the .exe unbundles into on the search path for dll file? MCR_CACHE_ROOT
http://www.mathworks.com/matlabcentral/answers/36794-mex-file-error-when-code-called-from-web-server
Krishan
Krishan on 2 May 2012
The dll is bundled with the .exe. When run the dll and .m file can be found in ctfroot\MyProject\
The exe works perfectly when run on my computer. I am able to use loadlibrary using the dll and the associated .m file when deployed on my computer.

Sign in to comment.


Krishan
Krishan on 3 May 2012
Any ideas? I'm kinda stuck.
As I said the exe works and uses loadlibrary perfectly when run on my computer. When run through a command window on my colleague's machine the error in the previous post shows up. I'm not sure how to fix the side-by-side configuration issue. I am not seeing it when I run it on my computer.
The dll is bundled with the exe and when run it can be found along with the .m file necessary to use loadlibrary in the deployed state in the ctfroot\MyProject\ directory.
  1 Comment
Kaustubha Govind
Kaustubha Govind on 3 May 2012
Perhaps a web search will help. For example: http://blogs.msdn.com/b/junfeng/archive/2006/04/14/576314.aspx

Sign in to comment.

Categories

Find more on C Shared Library Integration 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!