Event service routine

new topic     » goto parent     » topic index » view thread      » older message » newer message

Manny:

This is example of how to do the callback.
you need to create a callback using routine_id to
create a pointer to your TermIrq procedure.
This example is only for you to test the
idea and is not a complete working program. 

procedure TermIrq(integer port)
  -- do something  
end procedure

sio_term_irq_=define_c_func(Pcomm,"sio_term_irq",
                   {C_INT,C_POINTER,C_INT},C_INT)

global 
function sio_term_irq( integer port,atom TermIrq, atom code)
  ret=c_func(sio_term_irq_,{port,call_back(routine_id("TermIrq")),code})
  if ret=SIO_BADPORT then
    warnErr("Port is not opened in advance")
  end if
  if ret=SIO_WIN32FAIL then
    warnErr("Calling Win32 function failed")
  end if
  if ret=SIO_BADPARM then
    warnErr("Bad parameter")
  end if
  return ret
end function

Bernie

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu