You can generate C/C++ code out of a Simulink library by placing each library block into a new Simulink model, wrapping each library block into an Atomic Subsystem and generating code for the new model. Specifically, you can follow these steps:
1) Drag and drop all library blocks into a new Simulink model
2) Wrap each library block in a subsystem
3) Set the subsystem as Atomic (Right click -> Subsystem Parameters -> Treat as an Atomic Unit)
4) Set the system to generate code as a reusable function (Right click -> Subsystem Parameters -> 'Code Generation' tab -> set 'Function packaging' to 'Reusable function'
5) Generate code using Real-Time Workshop
The resulting generated code will then contain separate source files for each library block that you have included in the Simulink model. You can chose to use the source files directly in your C/C++ application, or optionally compile the source files into a static or shared library using a third-party compiler.
Best Answer