1.3k views
in System Integration by
I am also getting warnings from my compiler about the functions that are called via a native block, since there are no prototypes for them in my code  - but I cannot modify my application.c to include a file that would have those prototypes, since application.c is a generated file.

How do I get around this?

1 Answer

0 votes
by

As you already mentioned, it should be avoided to modify the generated code - this would be the end of maintainability...

The solution for the described problem is the usage of inline code. 

With inline code definitions you are able to store some snippets of native code (e.g. C code) within the project. During code generation these code snippets are output together with other project members strictly according to the order in which the members are defined. Typical application case is to use inline code to add '#include' directives to the generated code. In this manner you can combine the translated Chora platform-independent code with code to communicate with the target system.

Just take a 'Inline Code' template from the Gallery folder 'Chora' and put it into the unit where your device class resists. Please note, an inline code definition can exist only within a unit.

The inline code snippets are placed in the generated code according to their sequence (Z-order) within the unit file, together with other definitions, such as classes, constants, resources, and so on. Since you want to place the #include section at the beginning of the generated file you have to restack the inline brick backmost:

When you double-click on an Inline brick, you can see the content within the Code Editor. There you can insert your #include statements. Please note, that all inline definitions are considered during code generation only. They have no effect during prototyping.

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...