+(deftype user-callback () '(or function symbol))
+
+(define-type-method alien-type ((type user-callback))
+ (declare (ignore type))
+ (alien-type 'pointer-data))
+
+(define-type-method to-alien-form ((type user-callback) func &optional copy-p)
+ (declare (ignore type copy-p))
+ `(register-callback-function ,func))
+
+
+;; Callback marshaller for regular signal handlers
+(define-callback signal-handler-marshal nil
+ ((gclosure gclosure) (return-value gvalue) (n-params unsigned-int)
+ (param-values pointer) (invocation-hint pointer)
+ (callback-id pointer-data))
+ (declare (ignore gclosure invocation-hint))
+ (callback-trampoline #'invoke-signal-handler callback-id n-params param-values return-value))
+
+;; Callback marshaller for class handlers
+(define-callback class-handler-marshal nil