Lisp HUG Maillist Archive

Callbacks in graphical functions

I want to register a callback to a foreign C function.

In the FLI manual, in section 2.4.1 Passing Lisp objects to C, the text
mentions "a GUI action callback".

I want to provide a Lisp function to the C function which requires the
address of a callback. How can that be done? The manual is silent on
this matter.

Any help would be appreciated.

Thanks in advance

Sincerely
-- 
Dr Sian Mountbatten
http://www.poenikatu.co.uk/
Associate member of the FSF no. 10888
Asocia membro de la Libera Programara Fonduso n-ro 10888

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Callbacks in graphical functions

On 05/09/14 16:09, Sian Mountbatten wrote:
> I want to provide a Lisp function to the C function which requires the
> address of a callback. How can that be done? The manual is silent on
> this matter.

(fli:define-foreign-callable (get-random-int
                               :result-type :int)
  ()
 42)

(let ((cb-ptr (fli:make-pointer :symbol-name 'get-random-int
                                :functionp t)))
  (the-foreign-funcall cb-ptr))

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:34 UTC