[EDIT: I can no longer recreate my original error and can confirm that function-like objects can be used as callback functions to pass to solve in DifferentialEquations.jl.]
If I create a struct and a function-like object (as described in https://pkg.julialang.org/docs/julia/THl1k/1.1.1/manual/methods.html#Function-like-objects-1), how can I get a handle on the function as opposed to the object itself? I want to pass one as a function to PeriodicCallback in solve (using DifferentialEquations), but I get a MethodError: objects of type Controller are not callable (Controller is a struct I’ve defined).
If I create a named function rather than using the function-like object technique, it works as expected.
This morning I went back to the function-like object construction to recreate the error, so now things look like
controller = Controller( ... )
function (c::Controller)(integrator)
# some control stuff here
end
and just passing controller as the callback function is now working. At this point I have to assume I did something else wrong in my previous construction of the function-like object that led to the errors I was getting.