997 views
in System Integration by
In some case it is necessary to get information, defined in the C-code of an application within the Chora code of an Embedded Wizard UI project. How to achieve this?

1 Answer

0 votes
by

The only way to access a value from the C-application is in native code. It doesn’t matter whether the value comes from a #define or from a variable.

In the unit where we want to access a value from C-code we need to include the header file with the definition or declaration of the access function or definition. Get an "Inline Code"-brick from the Gallery into this unit and set your include e.g.

#include “Environment.h”

Note: It is recommended to change the order of the members of your unit to have the inline code back most. The order determines the sequence for the code generation starting from bottom to top. This ensures that the #include is inserted in the generated code at the beginning of the file.

Now we assume that there is a definition in the header file Environment.h e.g.

#define ENVIRONMENT_NO_OF_PORTS 4

To access this value we drag a new method in the class where we want to access the #define, rename the method to GetNoOfPorts() and set the return value to int32. In the editor window we can now implement the native code.

var int32 result = 0;

$if !$Prototyper

  native( result )
  {
    result = ENVIRONMENT_NO_OF_PORTS;
  }

$endif

return result;

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

...