Command: define_c_func
  
Syntax: 
  i1 = define_c_func(a, s1, s2, i2)
  
Description: 
  Define the characteristics of a C function that you wish to 
  call from your Euphoria/PEU program. A small integer will be 
  returned, or -1 if the function can't be found. a is an address 
  returned by open_dll. s1 is the name of the function. s2 is a 
  list of the parameter types for the function. i2 is the return 
  type of the function. A list of C types is contained in win32.e:
  
  global constant 
  C_CHAR    = #01000001,
  C_UCHAR   = #02000001,
  C_SHORT   = #01000002,
  C_USHORT  = #02000002,
  C_INT     = #01000004,
  C_UINT    = #02000004,
  C_LONG    = C_INT,
  C_ULONG   = C_UINT,
  C_POINTER = C_ULONG,
  C_FLOAT   = #03000004,
  C_DOUBLE  = #03000008
  
Comments: 
  The small integer can be passed to call_c_func when you
  want to call the C function.
  
  Parameter types which use 4 bytes or less are all passed the
  same way, so it is not necessary to be exact. However the 
  distinction between signed and unsigned may be important when 
  you specify the return type of a function.
  
  In this alpha release of v2.0, there is currently no way to
  pass structures or doubles by value, only by a pointer to
  the value.
  
Example: 
     
      -- LoadIconA is located in user32.dll
      -- It takes a C pointer and a C int as parameters.
      -- It returns a C int as a result.
      LoadIcon = define_c_func(user32, "LoadIconA", 
                               {C_POINTER, C_INT}, C_INT)
      if LoadIcon = -1 then
         puts(1, "LoadIconA could not be found!\n")
      end if
 
See Also: 
  define_c_proc, open_dll
  
