Library Compiler doesn't work well.

9 views (last 30 days)
법수 김
법수 김 on 9 Nov 2022
Edited: Piyush Dubey on 1 Sep 2023
Greetings.
Recently, I started converting my matlab codes (i.e., functions) as C++ library, header, and dynamic linking library.
For this, I added my functions and samples on liabray compiler tool.
However, after the tool converts my code as binary code, it is not packaging now. Furthermore, I waited for 24 hours more.
In this case, what should I do?
My Matlab running environment is as follows:
Matlab version : R2022b and installed all toolboxes
CPU : AMD Ryzen 3800XT
OS : Windows 11 Pro Education (22H2)
Memory : DDR4 64 GB
Storage : Samsung 970 EVO 1TB
Thank you
  1 Comment
Antoine
Antoine on 26 Jan 2023
I have the same issue. Did you manage to find a solution?

Sign in to comment.

Answers (1)

Piyush Dubey
Piyush Dubey on 1 Sep 2023
Edited: Piyush Dubey on 1 Sep 2023
Hi 법수,
I understand that you are trying to convert your MATLAB functions into a C++ library and create a Dynamic Linking Library (DLL) from it but facing issues with packaging the resulting binary code while using MATLAB’s library compiler.
In this case, you can try out the following approaches to successfully package your code:
  • Check Packaging Settings: Make sure you have configured the packaging settings correctly in MATLAB's Library Compiler. This includes specifying the output directory, choosing the correct packaging type (such as an installer or an archive), and ensuring that all necessary files are included in the package.
  • Dependency Management: If your MATLAB code relies on external dependencies or libraries, ensure that these dependencies are correctly included in the packaging. The Library Compiler should automatically detect dependencies and include them, but you might need to manually specify certain dependencies. Ensure all the dependencies are exported or installed using appropriate commands accordingly in the new environment.
  • Include Runtime Libraries: MATLAB Compiler Runtime (MCR) is required to run MATLAB-generated DLLs on machines that do not have MATLAB installed. Ensure that the correct version of MCR is included in your packaging and that the deployment strategy is set up appropriately.
  • Check Packaging Logs: If the packaging process fails, there should be log files or error messages generated by the Library Compiler. Examine these logs to identify the specific issues that are causing the packaging to fail.
  • Clean Intermediate Files: Sometimes, issues can arise due to conflicts with intermediate build files. Try cleaning out any temporary or intermediate files generated during the compilation process and then attempt the packaging again.
  • Version Compatibility: Ensure that the version of MATLAB you are using to generate the DLL and the version of MATLAB Compiler/Runtime you are using for packaging are compatible. Mismatched versions can lead to compatibility issues.
  • Test on Another System: If you are encountering problems on your current machine, try packaging and running your DLL on another system to see if the issue is machine-specific.
I hope this helps.

Categories

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