
                                 Externals

   Here is the information you need if you want to call C code, C++ code
   as well as Java code from your Eiffel code (to call an Eiffel feature
   from C, C++ or Java see [1]cecil documentation).

   Below is the current list of SmartEiffel external language
   specifications.

   external "C"

   The most common way to call external C code from Eiffel is to use the
   external "C" feature definition as described in the book "Eiffel The
   Language". The best is to start to browse examples of the SmartEiffel
   distribution in directory tutorial/external/C where you'll find
   external "C", external "C inline", external "C macro" examples.

   external "C++"

   The most common way to call external C++ code from Eiffel is to use
   the external C++ feature definition as described in the book "Eiffel
   The Language". The best is to start to browse examples of the
   SmartEiffel distribution in directory tutorial/external/C++ where
   you'll find external "C++" examples.

   external "Java"

   A brand new interface to call Java method or Java static method is
   also available. Obviously, this one is only supported when using the
   compile_to_jvm command (conversely, previous one are only supported
   when using the compile_to_c command). Again, and especially for this
   brand new one, the best is to start to browse examples of the
   SmartEiffel distribution in directory tutorial/external/Java.

   external "SmartEiffel"

   This external specification is reserved to the SmartEiffel compiler
   itself. Do not use it. Such a feature is directly supported both by
   compile_to_c and compile_to_jvm. For example, infix "+" of class
   INTEGER is directly mapped as C '+' by compile_to_c and mapped as an
   iadd JVM bytecode by compile_to_jvm.

   Inlining C Code (or assembly code)

   Another way to call C code from Eiffel is to use "c_inline_c" or
   "c_inline_h" as defined in our GENERAL class. The argument of
   "c_inline_c" (or "c_inline_h") must always be a manifest string which
   may contains the C code you want to put inlieu.
   Using c_inline_[c/h] also implies you do know exactly the C code
   SmartEiffel produces. For portability, it is also much better to use
   previous solutions.
   People who tinker with the C code generated by SmartEiffel, not
   limiting themselves to the Cecil and/or external interfaces, should
   also read [2]this page about the C code generated by SmartEiffel,
   Otherwise they might get into trouble.

                                   [Line]
             Copyright © Dominique COLNET and Suzanne COLLIN -
                         [3]<SmartEiffel@loria.fr>
                 Last modified: Fri Dec 6 16:35:29 CET 2002
                                      

References

   1. file://localhost/home/colnet/man/cecil.html
   2. file://localhost/home/colnet/man/c_code.html
   3. mailto:SmartEiffel@loria.fr
