Traveling Modelers also need vacation once and a while. So last week I had that! And enjoyed it at home. The only thing I did was visiting a Music Festival. But that was on walking distance from my home. It’s called “Dauwpop” which means “Dew Pop”, dew as the stuff that makes the grass wet in the morning and Pop after Popmusic.
It is called that way because in the Netherlands we have a tradition on Ascension Day: “Dauwtrappen”. That is to step on the morning dew. And that is what happens. On that day, mostly young people, go out very early and walk or ride bikes. They do that while taking drinks and stop regularly to drink something.

The festival also starts in the morning although not that early… My main reason for going was that M<Ali Jazz (from Faithless) would be there with a DJ session. But he cancelled last minute. Bad luck, but I still went there with my 2 sons and we had a great day.

A customer asked us a question via support this week. They wanted to use Rhapsody code in a library. The main code was made in Qt (pronounced “cute”) but they wanted to use Rhapsody for the control logic.

So the code must be compiled and then linked into a library.

That, unfortunately, is not it, some more must be done to get it working.

In the general Tab of a Rhapsody Component there are three selections, “Executable”, “Library” and “Other”. There is only one choice possible here. Both the OXF and the RXF use that to generate different code.

When you only use non-active and non-reactive classes and initialize everything dynamically, you don’t have to do anything. You can then just include the correct .h files where you want to use Rhapsody generated classes. But if you do use static objects you have to call the InitRelations() function that is generated, And if you use state-charts and/or activity diagrams you have to initialize and start the framework.

When “Executable” is selected, Rhapsody will generate your main function (Or a function that is directly called by main, depending on the OS you use) In case of a “Library”, a function is generated to start the framework and to initialize the objects in your model. This is true for both RXF and OXF. (In some RXF Versions this was not totally implemented…. take the generated file for the EXE and use that for the LIB… that’ll work.)

The best way to learn how to do this is to start with a simple model first. Create 2 Components with <Name>_LIB and <Name>_EXE, select “Executable” and “Library” respectively and generate code. I always use beyond compare to compare two directories but there are enough other good working compare tools.

Then create 2 classes (“A” and “B”), connect them using an association, create a third class with a structure diagram to instantiate the other 2 (Don’t forget to create an instance of that class !!) now give them a small state-machine (or activity diagram) and make one of then active.

Again, generate code and see the differences. I made life simple for you…. I made the model and saved it (In Rhapsody 8.1.5, old but probably useable by everybody)

Happy Modeling with Rhapsody

Walter van der Heiden (wvdheiden@sodiuswillert.com)