October 19, 2002
MCL Callbacks

This is pretty obscure, but it comes up every couple years on the MCL mailing list, and the archives of that list are spotty so it's information that's difficult to dig up if you're faced with this problem.

In MCL, you can define a function that can be used as a callback from C using defccallable. But that doesn't work for all APIs expecting callbacks, especially in the more "modern" APIs (QuickDraw 3D, QuickDraw GX, er, which are both obsolete. anyway.). In that case, you want something like this:

(defun callback-pointer (fn-ptr)
  "Turns a \"defccallable\" function pointer into one that C can call."
  (ccl:pref (ccl:pref fn-ptr :RoutineDescriptor.RoutineRecords)
            :RoutineRecord.ProcDescriptor))
Posted by jjwiseman at October 19, 2002 10:47 AM
Comments
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?