User Tools

Site Tools


tutorial_external_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial_external_function [2017/04/19 12:44]
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("​exFuncExample.ab"​);​ prog = ReadAlphabets("​exFuncExample.ab"​);​
  
Line 51: Line 51:
  
 Along with the two C codes for ''​WriteC''​ and ''​Wrapper'',​ you will find a header file, ''​external_functions.h''​ with the following contents. Along with the two C codes for ''​WriteC''​ and ''​Wrapper'',​ you will find a header file, ''​external_functions.h''​ with the following contents.
-<sxh c; gutter:false>+<sxh c; gutter:true>
 //External functions //External functions
 /​***PROTECTED REGION ID(external_functions) ENABLED START***/ /​***PROTECTED REGION ID(external_functions) ENABLED START***/
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 ​cttpp; gutter:false>+<​sxh ​c; gutter:true>
 //External functions //External functions
 /​***PROTECTED REGION ID(external_functions) ENABLED START***/ /​***PROTECTED REGION ID(external_functions) ENABLED START***/
tutorial_external_function.txt ยท Last modified: 2017/04/19 13:25 by waruna