Skip to end of metadata
Go to start of metadata

You can import existing libraries into Enterprise Architect, so you can use them in class diagrams to add dependencies, or to use functions of these libraries in your behavioral models.

This is perfect for integrating legacy code into your application, and also if you're doing split development (one part model-based, one part classical). Before you import your libraries into the model, make sure that you've disabled Object Oriented Support for C under Tools → Options…


 
To import the external C libraries into Enterprise Architect, go to Tools → Source Code Engineering → Import C-Files… and select the libraries you want to import.

The libraries will be imported as classes, but you want them as interfaces instead. To change their type, select the imported classes and go to Element → Advanced → Change Type… where you can change them to Interfaces. Now you can use the imported operations in your model.

To include references to the libraries in your code, use the Dependency or Usage relations from your class to the interface.

When importing headers with functions, make sure to mark the imported interface as static as described here.

Version 2.1

When setting the stereotype standard lib on an external library the code generation will generate a standard library include.

e.g.:

#inlcude <string> // with standard lib stereotype

contrary to normal include containtin the ".h" extension

#inlcude <string.h> // without standard lib stereotype


Don't put the imported libraries into the package for which you generate code, otherwise Embedded Engineer will generate code for these interfaces as well!
Put them somewhere else where you can keep a good overview on your imported interfaces.

If you have to have them in the package, mark them with the NoCodeGen tagged value as described here.

See also

Dependencies

  • No labels