updating oE call_back


include dll.e 
namespace dll 
public function call_back(object id) 

gets a machine address for an Euphoria procedure.

  1. id : an object, either the id returned by routine_id (for the function or procedure), or a pair {'+', id}.

An atom, the address of the machine code of the routine. It can be used by Windows, an external C routine in a Windows .dll, or Unix shared library (.so), as a 32-bit "call-back" address for calling your Euphoria routine.


The length of name should not exceed 1_024 characters.


By default, your routine will work with the stdcall convention. On Windows you can specify its id as {'+', id}, in which case it will work with the cdecl calling convention instead. On Unix platforms, you should only use simple IDs, as there is just one standard cdecl calling convention.

You can set up as many call-back functions as you like, but they must all be Euphoria functions (or types) with 0 to 9 arguments. If your routine has nothing to return (it should really be a procedure), just return 0 (say), and the calling C routine can ignore the result.

When your routine is called, the argument values will all be 32-bit unsigned (positive) values. You should declare each parameter of your routine as atom, unless you want to impose tighter checking. Your routine must return a 32-bit integer value.

You can also use a call-back address to specify a Euphoria routine as an exception handler in the Linux or FreeBSD signal function. For example, you might want to catch the SIGTERM signal, and do a graceful shutdown. Some Web hosts send a SIGTERM to a CGI process that has used too much CPU time.

A call-back routine that uses the cdecl convention and returns a floating-point result, might not work with euiw. This is because the Watcom C compiler (used to build euiw) has a non-standard way of handling cdecl floating-point return values.

Example 1:

See: .../euphoria/demo/win32/window.exw

Example 2:

See: .../euphoria/demo/linux/qsort.ex

See Also:


Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu