home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-13 | 832 b | 42 lines | [TEXT/ttxt] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class EXAMPLE
- --
- -- The Eiffel program is running first, then call the C program
- -- which is in charge to add to INTEGER using the infix "+"
- -- of class INTEGER.
- --
- -- To compile this example, use command :
- --
- -- compile -cecil cecil.se example c_prog.c
- --
-
- creation make
-
- feature
-
- make is
- local
- i1, i2, sum: INTEGER;
- do
- i1 := 2;
- i2 := 3;
- io.put_integer(i1);
- io.put_string(" + ");
- io.put_integer(i2);
- io.put_string(" = ");
- sum := call_c_prog(i1,i2);
- io.put_integer(sum);
- io.put_string("%N");
- end;
-
- feature {NONE}
-
- call_c_prog(i1, i2: INTEGER): INTEGER is
- external "C"
- alias "c_prog"
- end;
-
- end -- EXAMPLE
-