mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 15:22:31 +01:00
Author:admin
Date:2011-04-12T16:13:35.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@871 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -30,39 +30,39 @@ extern size_t one_param_return(FILE *f);</code>
|
||||
|
||||
Here is the corresponding Eiffel code:
|
||||
<code>
|
||||
c_no_param
|
||||
-- Encapsulation of a C routine with no parameter.
|
||||
external
|
||||
"C | %"my_header.h%""
|
||||
alias
|
||||
"no_param"
|
||||
end
|
||||
c_no_param
|
||||
-- Encapsulation of a C routine with no parameter.
|
||||
external
|
||||
"C | %"my_header.h%""
|
||||
alias
|
||||
"no_param"
|
||||
end
|
||||
|
||||
c_one_param (i: INTEGER)
|
||||
-- Encapsulation of a C routine with one parameter.
|
||||
external
|
||||
"C (int) | %"my_header.h%""
|
||||
alias
|
||||
"one_param"
|
||||
end
|
||||
c_one_param (i: INTEGER)
|
||||
-- Encapsulation of a C routine with one parameter.
|
||||
external
|
||||
"C (int) | %"my_header.h%""
|
||||
alias
|
||||
"one_param"
|
||||
end
|
||||
|
||||
c_no_param_return: INTEGER
|
||||
-- Encapsulation of a C routine with no parameter
|
||||
-- returning an INTEGER
|
||||
external
|
||||
"C (): EIF_INTEGER| %"my_header.h%""
|
||||
alias
|
||||
"no_param_return"
|
||||
end
|
||||
c_no_param_return: INTEGER
|
||||
-- Encapsulation of a C routine with no parameter
|
||||
-- returning an INTEGER
|
||||
external
|
||||
"C (): EIF_INTEGER| %"my_header.h%""
|
||||
alias
|
||||
"no_param_return"
|
||||
end
|
||||
|
||||
c_one_param_return (p: POINTER): INTEGER
|
||||
-- Encapsulation of a C routine with one parameter
|
||||
-- returning an INTEGER
|
||||
external
|
||||
"C (FILE *): EIF_INTEGER| %"my_header.h%""
|
||||
alias
|
||||
"one_param_return"
|
||||
end</code>
|
||||
c_one_param_return (p: POINTER): INTEGER
|
||||
-- Encapsulation of a C routine with one parameter
|
||||
-- returning an INTEGER
|
||||
external
|
||||
"C (FILE *): EIF_INTEGER| %"my_header.h%""
|
||||
alias
|
||||
"one_param_return"
|
||||
end</code>
|
||||
<span id="macros"></span>
|
||||
|
||||
|
||||
@@ -82,29 +82,29 @@ Then, the corresponding Eiffel code will look like:
|
||||
|
||||
|
||||
<code>
|
||||
menu_id: INTEGER
|
||||
-- `ID_MENU' C encapsulation.
|
||||
external
|
||||
"C [macro %"my_header.h%"] : EIF_INTEGER"
|
||||
alias
|
||||
"ID_MENU"
|
||||
end
|
||||
menu_id: INTEGER
|
||||
-- `ID_MENU' C encapsulation.
|
||||
external
|
||||
"C [macro %"my_header.h%"] : EIF_INTEGER"
|
||||
alias
|
||||
"ID_MENU"
|
||||
end
|
||||
|
||||
menu_id_character: CHARACTER
|
||||
-- `ID_MENU_CHARACTER' C encapsulation.
|
||||
external
|
||||
"C [macro %"my_header.h%"] : EIF_CHARACTER"
|
||||
alias
|
||||
"ID_MENU_CHARACTER"
|
||||
end
|
||||
menu_id_character: CHARACTER
|
||||
-- `ID_MENU_CHARACTER' C encapsulation.
|
||||
external
|
||||
"C [macro %"my_header.h%"] : EIF_CHARACTER"
|
||||
alias
|
||||
"ID_MENU_CHARACTER"
|
||||
end
|
||||
|
||||
i_th (p: POINTER; i: INTEGER): INTEGER
|
||||
-- Access the `i'-th element of `p', array of C EIF_INTEGER.
|
||||
external
|
||||
"C [macro %"my_header.h%"] (EIF_INTEGER *, EIF_INTEGER): EIF_INTEGER"
|
||||
alias
|
||||
"i_th"
|
||||
end</code>
|
||||
i_th (p: POINTER; i: INTEGER): INTEGER
|
||||
-- Access the `i'-th element of `p', array of C EIF_INTEGER.
|
||||
external
|
||||
"C [macro %"my_header.h%"] (EIF_INTEGER *, EIF_INTEGER): EIF_INTEGER"
|
||||
alias
|
||||
"i_th"
|
||||
end</code>
|
||||
<span id="structs"></span>
|
||||
|
||||
|
||||
@@ -125,37 +125,37 @@ typdef struct point {
|
||||
|
||||
Then, the corresponding Eiffel code will look like:
|
||||
<code>
|
||||
x (p: POINTER): INTEGER
|
||||
-- Access field x of struct pointed by `p'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point): EIF_INTEGER"
|
||||
alias
|
||||
"x"
|
||||
end
|
||||
x (p: POINTER): INTEGER
|
||||
-- Access field x of struct pointed by `p'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point): EIF_INTEGER"
|
||||
alias
|
||||
"x"
|
||||
end
|
||||
|
||||
y (p: POINTER): INTEGER
|
||||
-- Access field y of struct pointed by `p'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point): EIF_INTEGER"
|
||||
alias
|
||||
"y"
|
||||
end
|
||||
y (p: POINTER): INTEGER
|
||||
-- Access field y of struct pointed by `p'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point): EIF_INTEGER"
|
||||
alias
|
||||
"y"
|
||||
end
|
||||
|
||||
set_x (p: POINTER; v: INTEGER)
|
||||
-- Set field x of struct pointed by `p'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point, int)"
|
||||
alias
|
||||
"x"
|
||||
end
|
||||
set_x (p: POINTER; v: INTEGER)
|
||||
-- Set field x of struct pointed by `p'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point, int)"
|
||||
alias
|
||||
"x"
|
||||
end
|
||||
|
||||
set_y (p: POINTER: v: INTEGER)
|
||||
-- Set field y of struct pointed by `p' with `v'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point, int)"
|
||||
alias
|
||||
"y"
|
||||
end</code>
|
||||
set_y (p: POINTER: v: INTEGER)
|
||||
-- Set field y of struct pointed by `p' with `v'.
|
||||
external
|
||||
"C [struct %"my_header.h%"] (Point, int)"
|
||||
alias
|
||||
"y"
|
||||
end</code>
|
||||
<span id="windows"></span>
|
||||
|
||||
|
||||
@@ -171,17 +171,17 @@ Therefore if you want to call an external routine defined in a DLL supposed to b
|
||||
|
||||
|
||||
<code>
|
||||
my_cdecl_routine (a: INTEGER): POINTER
|
||||
-- Encapsulation of a dll function with the `_cdecl' call mechanism.
|
||||
external
|
||||
"C [dll32 %"my_dll.dll%"] (int): EIF_POINTER"
|
||||
end
|
||||
my_cdecl_routine (a: INTEGER): POINTER
|
||||
-- Encapsulation of a dll function with the `_cdecl' call mechanism.
|
||||
external
|
||||
"C [dll32 %"my_dll.dll%"] (int): EIF_POINTER"
|
||||
end
|
||||
|
||||
my_stdcall_routine (a: INTEGER): POINTER
|
||||
-- Encapsulation of a dll function with the `_stdcall' call mechanism.
|
||||
external
|
||||
"C [dllwin32 %"my_dll.dll%"] (int): EIF_POINTER"
|
||||
end</code>
|
||||
my_stdcall_routine (a: INTEGER): POINTER
|
||||
-- Encapsulation of a dll function with the `_stdcall' call mechanism.
|
||||
external
|
||||
"C [dllwin32 %"my_dll.dll%"] (int): EIF_POINTER"
|
||||
end</code>
|
||||
|
||||
|
||||
{{warning|Using '''dll32''' in cases calling for '''dllwin32''' and vice versa will cause your system to crash, because the C call stack will be corrupted. For more information please read your C compiler documentation. }}
|
||||
@@ -207,13 +207,13 @@ In WEL, the encapsulation is written as:
|
||||
|
||||
|
||||
<code>
|
||||
cwin_send_message (hwnd: POINTER; msg, wparam, param: INTEGER)
|
||||
-- SDK SendMessage (without the result)
|
||||
external
|
||||
"C [macro %"wel.h%"] (HWND, UINT, WPARAM, LPARAM)"
|
||||
alias
|
||||
"SendMessage"
|
||||
end</code>
|
||||
cwin_send_message (hwnd: POINTER; msg, wparam, param: INTEGER)
|
||||
-- SDK SendMessage (without the result)
|
||||
external
|
||||
"C [macro %"wel.h%"] (HWND, UINT, WPARAM, LPARAM)"
|
||||
alias
|
||||
"SendMessage"
|
||||
end</code>
|
||||
|
||||
|
||||
{{seealso|<br/>
|
||||
|
||||
Reference in New Issue
Block a user