Support using closures as DCA callbacks (see #5772)