Loading ...
Sorry, an error occurred while loading the content.

Re: Documentation on C inline

Expand Messages
  • larryliuming
    I don¡¯t know if there are documents, I think the ¡°C inline¡± is simple to use  :) For simple ¡°C inline¡± usage: 1.For C You should write
    Message 1 of 3 , Jun 1, 2008
    • 0 Attachment
      I don¡¯t know if there are documents, I think the ¡°C inline¡± is simple
      to use  :)

      For simple ¡°C inline¡± usage:

      1.For C

      You should write something like:

      "C inline use <your_header.h>"

      A simple example:

      c_your_external (a_parameter: POINTER; a_return_integer:
      TYPED_POINTER [INTEGER]; a_int: INTEGER): POINTER is
      -- C external example
      require
      a_parameter_created: a_parameter /= default_pointer
      external
      "C inline use <your_header.h>" ¨C Please replace ¡°your_header.h¡±
      with proper header file name
      alias
      "[
      { //Use a curly bracket is better since it can create a local scope
      for following external C codes

      // You can declare C locals
      SomeCType *l_result = NULL;

      //If you want to use parameter which passed from this Eiffel external
      feature, you must have the pre-fix ¡°$¡± before your parameter name
      *(EIF_INTEGER *) $a_return_integer = 1;

      //You can write other normal C codes here

      // This line can return C result to this Eiffel external feature¡¯s result
      return (EIF_POINTER) l_result;
      }
      ]"
      end

      For real example, please see:

      {WEL_GDIP_IMAGE}, {WEL_GDIP_ANY} and ¡­ in WEL library

      2.For C++

      You should write something like:

      "C++ inline use <your_header.h>"

      A simple example:

      c_your_cpp_external (a_parameter: POINTER; a_return_integer:
      TYPED_POINTER [INTEGER]; a_int: INTEGER): POINTER is
      -- C++ external example
      require
      a_parameter_created: a_parameter /= default_pointer
      external
      "C++ inline use <your_header.h>"
      alias
      "[
      { //Same as C external example, use a curly bracket is better since
      it can create a local scope for following external C codes

      SomeCType *l_result = NULL;

      //If you want to use parameter which passed from this Eiffel external
      feature, you must have the pre-fix ¡°$¡± before your parameter name
      *(EIF_INTEGER *) $a_return_integer = 1;

      //You can write other normal C++ codes here

      // This line can return C++ result to this Eiffel external feature¡¯s
      result
      return (EIF_POINTER) l_result;
      }
      ]"
      end

      For real example, please see:

      Class {CLI_COM} {MD_IMPORT} and ¡­ in Eiffel Studio project.

      Hope it helps. Please let me if you have any questions.
    • Chris Saunders
      Thanks for the assistance Larry, its much appreciated. Finding documentation on the newer aspects of Eiffel is quite difficult. I personally find ECMA all
      Message 2 of 3 , Jun 1, 2008
      • 0 Attachment
        Thanks for the assistance Larry, its much appreciated. Finding
        documentation on the newer aspects of Eiffel is quite difficult. I
        personally find ECMA all that helpful.



        Regards

        Chris Saunders



        From: eiffel_software@yahoogroups.com
        [mailto:eiffel_software@yahoogroups.com] On Behalf Of larryliuming
        Sent: Sunday, June 01, 2008 10:59 PM
        To: eiffel_software@yahoogroups.com
        Subject: [eiffel_software] Re: Documentation on C inline



        I don¡¯t know if there are documents, I think the ¡°C inline¡± is simple
        to use  :)

        For simple ¡°C inline¡± usage:

        1.For C

        You should write something like:

        "C inline use <your_header.h>"

        A simple example:

        c_your_external (a_parameter: POINTER; a_return_integer:
        TYPED_POINTER [INTEGER]; a_int: INTEGER): POINTER is
        -- C external example
        require
        a_parameter_created: a_parameter /= default_pointer
        external
        "C inline use <your_header.h>" ¨C Please replace ¡°your_header.h¡±
        with proper header file name
        alias
        "[
        { //Use a curly bracket is better since it can create a local scope
        for following external C codes

        // You can declare C locals
        SomeCType *l_result = NULL;

        //If you want to use parameter which passed from this Eiffel external
        feature, you must have the pre-fix ¡°$¡± before your parameter name
        *(EIF_INTEGER *) $a_return_integer = 1;

        //You can write other normal C codes here

        // This line can return C result to this Eiffel external feature¡¯s result
        return (EIF_POINTER) l_result;
        }
        ]"
        end

        For real example, please see:

        {WEL_GDIP_IMAGE}, {WEL_GDIP_ANY} and ¡­ in WEL library

        2.For C++

        You should write something like:

        "C++ inline use <your_header.h>"

        A simple example:

        c_your_cpp_external (a_parameter: POINTER; a_return_integer:
        TYPED_POINTER [INTEGER]; a_int: INTEGER): POINTER is
        -- C++ external example
        require
        a_parameter_created: a_parameter /= default_pointer
        external
        "C++ inline use <your_header.h>"
        alias
        "[
        { //Same as C external example, use a curly bracket is better since
        it can create a local scope for following external C codes

        SomeCType *l_result = NULL;

        //If you want to use parameter which passed from this Eiffel external
        feature, you must have the pre-fix ¡°$¡± before your parameter name
        *(EIF_INTEGER *) $a_return_integer = 1;

        //You can write other normal C++ codes here

        // This line can return C++ result to this Eiffel external feature¡¯s
        result
        return (EIF_POINTER) l_result;
        }
        ]"
        end

        For real example, please see:

        Class {CLI_COM} {MD_IMPORT} and ¡­ in Eiffel Studio project.

        Hope it helps. Please let me if you have any questions.





        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.