This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
tutorial_external_function [2017/04/19 13:03] waruna [Example] |
tutorial_external_function [2017/04/19 13:25] waruna [Example] |
||
---|---|---|---|
Line 23: | Line 23: | ||
====Example==== | ====Example==== | ||
Let's take a simple example with two external functions. One is a function that computes square root, and another is some user function that returns float given an integer. | Let's take a simple example with two external functions. One is a function that computes square root, and another is some user function that returns float given an integer. | ||
- | <sxh alphabets; gutter:false> | + | <sxh alphabets; gutter:true> |
float sqrt(float); | float sqrt(float); | ||
float userfunc(int); | float userfunc(int); | ||
Line 40: | Line 40: | ||
Generate code with the following script. | Generate code with the following script. | ||
- | <sxh cs; gutter:false> | + | <sxh cs; gutter:true> |
prog = ReadAlphabets(" | prog = ReadAlphabets(" | ||
Line 51: | Line 51: | ||
Along with the two C codes for '' | Along with the two C codes for '' | ||
- | <sxh c; gutter:false> | + | <sxh c; gutter:true> |
//External functions | //External functions | ||
/ | / | ||
Line 63: | Line 63: | ||
\\ | \\ | ||
The other function needs a body, and it can be anything as long as it returns a floating point value. An example of the completed header file is shown below. | The other function needs a body, and it can be anything as long as it returns a floating point value. An example of the completed header file is shown below. | ||
- | <sxh c; gutter:false> | + | <sxh c; gutter:true> |
//External functions | //External functions | ||
/ | / |