Use of matlab dlls as third party dependencies

11 views (last 30 days)
Hi guys,
I am trying to build a Qt application which will generates .mat files. Last year I was using a 32 bits Qt framework and it was working fine. I had two matlab dlls (coming from matlab 2018b if I do remember well) as third party dependencies: libmat.dll and libmx.dll, I could compile and execute my application without any issue.
But the application will frequently use more than 2 Gb of RAM and than is why I am migrating to a 64 bits Qt framework. However Qt is struggling to load matlab dlls. Either a dll is missing or I get the error code 0xc000007b which means that I am using 32-bits and 64-bits dlls.
I already post a question about Qt on their forum but we where not able to find a solution. That is why I am posting the question here.
I have matlab 2022b installed on my machine (Windows x64 bits)
I can see in <matlab_root>/bin/win64 folder the dlls I am looking for: libmat.dll and libmx.dll and I am using mat.h, matrix.h and tmwtypes.h from <matlab_root>/extern/include folder in the source code to interact with the dlls. At that point, I am able to compile (So the matlab libraries are found by Qt) but if I try to start the application, Qt is complaining because some dlls are missing: libmwfl.dll, libmwflstorageutility.dll etc..
Apparently, Qt is also looking in the Windows PATH variable to search for dlls, I had a look in my system path and I can see two paths:
I know this is a matlab forum, not a Qt one, but do you guys have an idea of what I should do to use matlab as a third party dependency ?
Have a nice day,
Pierre-Emmanuel
  5 Comments
Pierre-Emmanuel de Robien
Pierre-Emmanuel de Robien on 20 Jan 2025
Hi,
I did not forget about the small app to deliver for you to test. I should be able to deliver something today
Thank you again for your patience.
Have a nice day,
Pierre-Emmanuel
Pierre-Emmanuel de Robien
Pierre-Emmanuel de Robien on 20 Jan 2025
Hi again !
I created a simple a Qt console application. As described in the question on the Qt forum, I am using Qt 6.8.1, Qt Creator 15.0.0 and I am using mingw 13.1.0 64 bits.
The goal of the application is to create a .mat file at "C:\Tools\MyMatFile.mat" containing one parameter "MyParameter" containing 6 values for 6 different timestamp.
I have no issue to build, but when running the application, a popup appears saying that a dll was missing. Each time with a new missing dlls. And sometimes I have the 0xc000007b error code.
Good luck for your investigation. If you find something I should change/try, I would be happy to do it !
On my side, I will try to have a cleaned PATH environment variable and add step-by-step only what is mandatory.
Have a nice day,
Pierre-Emmanuel

Sign in to comment.

Accepted Answer

Pierre-Emmanuel de Robien
Pierre-Emmanuel de Robien on 20 Jan 2025
Hi guys,
I finally figured out why Qt was complaining about missing dlls. When matlab is installed, it adds <matlab_folder>/bin and <matlab_folder>/runtime/win64 to the PATH environment variable. However, the dlls I need to use are in the <matlab_folder>/bin/win64.
By adding this folder to the PATH and now it is working again.
  1 Comment
埃博拉酱
埃博拉酱 on 21 Jan 2025
Edited: 埃博拉酱 on 21 Jan 2025
The magic of building a minimal reproducible demo is not only to help others identify your problem, but more importantly, very often, you will find and solve the problem yourself directly through this process.

Sign in to comment.

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!