I’d like to use a function f() defined in a module as a callback in another function g() in the same module. However, I encountered this error:
ERROR: LoadError: UndefVarError: f not defined.
moving the definition of function f() before the definition g() does make it work.
I googled a bit and tried adding ‘$’ before f() in @cfunction, by doing this, the file can be included without error, but still fail to run and the REPL complained about type mismatch between ::Base.CFunction and ::Ptr{Nothing}.
Please help me out this situation. Thank you.
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Xeon(R) CPU X5670 @ 2.93GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, westmere)