Compiler and shared C library

1 view (last 30 days)
Leor Greenberger
Leor Greenberger on 8 Jun 2013
Hi all,
I am trying to understand how to use the Compiler toolbox to distribute a shared C library. What I currently have in MATLAB is 5 functions, each in its own .m file, and each one can be run essentially as a standalone. That is, you call one of the functions, pass some arguments, it runs for a few minutes and returns some values. I also have a separate directory in the MATLAB path that contains all sorts of functions that I am calling from my 5 main functions. I will refer to this as the '.m library folder'. Some of these I created myself, some I downloaded from FEX. What I want to do is generate each of the 5 functions as a separate C shared library, so that each can be called separately from C. How do I go about doing this? Do I create 5 separate projects in the Compiler toolbox? Do I include the .m library folder with each project or can I compile each of those files separately and link them later?
  2 Comments
Walter Roberson
Walter Roberson on 8 Jun 2013
Do you need 5 different entry points to the same library, or do you need 5 different libraries? If you used different libraries the implication would be that each different library would be able to do just one thing and users would have to link multiple libraries if they wanted to be able to call more than one function. If you used one library with 5 entry points, all the code would be in one library and the user could link just the one and use any of the functions from it.
Leor Greenberger
Leor Greenberger on 8 Jun 2013
Thanks Walter. I have to think about this. Another problem I am having is in finding clear and concise documentation for the C programmer on how he can integrate the compiled matlab shared libraries in his C code. He has no knowledge or experience with MATLAB. I downloaded the Compiler toolbox pdf documentation here http://www.mathworks.com/help/pdf_doc/compiler/compiler.pdf but its so disorganized. And it sends you to different documents for various things. For example, it doesn't cover MATLAB data types and their C equivalent.. it refers you to the External Interface document (<http://www.mathworks.com/help/pdf_doc/matlab/apiext.pdf>) under the MEX chapter to learn about data types. And other documents for the MCR API. It's so just confusing and hard to follow. Do you know if there is something written that details everything he has to know in one place? Thanks!

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!