in GUI Development by
Hello Paul,

        I want to ask,Is there a log math on the embedded wizard ?Why can't I find ?

   for example:     lg100 = 2;

       What should this express?

  If without the math_log,Is there any way I can replace it ?

Best regards,


2 Answers

0 votes

Hello Tonny,

the actual version supports only few mathematical functions. We plan to enhace this set in one of the next versions.

For your actual application case, I would implement the necessary code in C within a native statement. For example:

var float operand = ...
var float result  = 0.0;

$if !$prototyper
  native ( operand, result )
    /* Predeclaration of the log() function found in stdlib */
    extern double log( double x );

    result = log( operand );

trace result;

Please note, this implementation will not work in Prototyper and it expects that there is a function log() within the C stdlib.

Does it help you?

Best regards

Paul Banach


Hello Paul,

     I don't quite understand your explanation .

Step 1: I set up a Device Interface and set up a method;

Step 2: I directly call this new defined function.

Question:Why is my result not equal to the correct answer ?Did I do something wrong ?


Best regards,


+1 vote


your application requires the math-function log(). As explained in the preceding answer, you have the possibility to invoke the stdlib function log() directly from native code. This approach is fully sufficient to use the function log() at the runtime in the target device. It is however not sufficient to use the function log() during the prototyping (when you test the application or a GUI component in Embedded Wizard Studio). The reason, Chora implements actually only few of the most important math functions. log() as well as log10() don't belong to this set.

What can we do?

One possibility would be to implement the log or log10 algorithm in Chora. This is not an easy task. Another approach is to provide the missing functionality in so-called Intrinsic Module. With Intrinsic Modules it is possible to extend the functionality of the Prototyping Environment. From technical point of view, an Intrinsic Module is an ordinary Windows DLL (dynamically loadable library), which Embedded Wizard can load automatically when you start the Prototyper. Once loaded, the C functions implemented in the Intrinsic Module are exposed to Chora and can be invoked when you test the application in Embedded Wizard Studio.

For the convenience of all readers of this thread I have prepared such Intrinsic Module and a simple Embedded Wizard project demonstrating its usage.

1. Please download and unzip the following file:


2. Once unziped, you can open the Embedded Wizard project extmath_test.ewp. Please note, the project has been created with version 9.20.

3. As you see, the example consists of a single, simple GUI component:

4. Start the Prototyper by pressing the keys Ctrl+F5.

5. In the Prototyper window you can now press the push buttons Call Log10 and Call Log. This causes the corresponding onButton1 or onButton2 slot method to be called. These slot methods, in turn, invoke the math methods Log10 or Log. For test purpose the functions are called with 0.5 as parameter. The outputs appear in the Log window:

6. Now, take a look at the implementation of the Log10 method. This method implement the operation log10:

As you see this method distinguishes between two cases. The first $if condition is true when the code is executed in Prototyping Environment (when you test the application in Embedded Wizard Studio). This code invokes a function named extmath_log10(). This function is implemented in the above introduced Intrinsic Module.

Please take a look in the directory containing the example. You see there a file named ExtMath.ewi. This is the Intrinsic Module I have provided for you. That this Intrinsic Module is in use can be seen in Log window just in the moment when you start the Prototyping for the application:

The second $if condition in the method Log10 is used when the code is executed in target device. In such case the method simply invokes the STDLIB math function log10().

To use the functionality in your project:

6. Copy the Intrinsic Module ExtMath.ewi to the directory of your own project.

7. Copy the desired method Log10 or Log to the component where you need to use the log operation.

8. Within the component, invoke the Log10 or Log methods where you want the log value to be calculated.

I hope it helps you further.

Best regards

Paul Banach

Hello Paul.  

     Thank you for your detailed reply !

      It really helped me a lot ,Thank you very much!!

Best regards,


Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint