Combining mpicc and compiled Matlab functions using "deploytool"

From COSSAN Wiki
Jump to: navigation, search
  1. type "deploytool" in Matlab command window
  2. start new project
  3. select "C-shared library", give the project a name (e.g. libmatrix) and select the location
  4. right click on "Exported functions" and select the files which should be put in the shared library
  5. right click on C/C++ files and select the C-files that should be part of the library (but not the wrapper c-file, even though that will work, too, it will just cause the library to be much larger and the executable much smaller; otherwise the opposite is true)
  6. in settings, change the library name (if needed), the output directory to the directory where you want the library to reside (I prefer not to put it in the distrib directory, too far up)
  7. select the compiler options file ( as needed (e.g. for mpicc need to have gcc modified)
  8. OK and save
  9. build the project --> will generate (or whichever name you specified)
  10. link with: mbuild wrapper.c -L. -llibname -I. -f (e.g. mbuild matrixdriver.c -L. -lmatrix -I. -f