Yes, eval defines things in the top-level scope, so you normally don't use it inside functions.
However, cfunction inherently does not work with anonymous functions,
essentially because C functions can't represent closures.
To pass closures (anonymous/inner functions) to C, you'll want to use a
different technique. See:
http://julialang.org/blog/2013/05/callback/
for an overview.
