title: Simulink Coder, add external C libraries placed outside the working directory
body: <p>Following problem: I'm using Simulink Coder, an Arduino Due and a self developed expansion board to control multicopters. I've a Simulink model with all the device drivers (made with s-function builder) to interact with the sensors. Every sensor has an own c++ library which is included in the s-function. All the c++ and header files are currently in the working directory of matlab. </p>
  
  <p>No I have so many device driver blocks, that I made a custom Simulink block library in order to share and use these blocks in multiple Simulink models. However, if I'm using the blocks from my Simulink library the compiler gives an error because it can't find the c++ and header files, as they are not in the current working directory but in the directory of the Simulink library. However the Simulink block library and all the external c++ libraries are included in the Matlab search path (set path). </p>
  
  <p>So does anyone know how to include external c++ libraries when they are called from an s-function in a Simulink block library? </p>
  
  <p>I already tried following steps:</p>
  
  <ul>
  <li>I tried to include the c++ and header files with following matlab command (doesn't work): set_param('SimulinkModelName','CustomSource',"LibraryName");</li>
  <li>Copy the c++ and header files to the directory of the c++ libraries of the Arduino Simulink support package (doesn't work).</li>
  <li>Copy all the c++ and header files into the directory of the current Simulink model (does work however I don't want to copy all the files every time a new simulink model is created)</li>
  </ul>
  
  <p>Does anyone had similar problems so far? </p>