Does ccall still work in 0.6.1?


I’m trying to use ccall in 0.6.1, and I receive an error telling me that it is undefined:

julia> ccall
ERROR: UndefVarError: ccall not defined

I’m not even sure where to start with this. Is it now necessary to import something?


ccall is pretty special:

help?> ccall                                                                                                                                                             
search: ccall AbstractChannel                                                                                                                                            
  ccall((symbol, library) or function_pointer, ReturnType, (ArgumentType1, ...), ArgumentValue1, ...)                                                                    
  Call function in C-exported shared library, specified by (function name, library) tuple, where each component is a string or symbol.                                   

  Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression. Alternatively, ccall may also be used to call a function     
  pointer, such as one returned by dlsym.                                                                                                                                

  Each ArgumentValue to the ccall will be converted to the corresponding ArgumentType, by automatic insertion of calls to unsafe_convert(ArgumentType,
  cconvert(ArgumentType, ArgumentValue)). (See also the documentation for each of these functions for further details.) In most cases, this simply results in a call to
  convert(ArgumentType, ArgumentValue).

julia> ccall                                                                                                                                                             
ERROR: UndefVarError: ccall not defined                                                                                                                                  

julia> ccall((:asdf, :asdf), Int, (Int,), 5)                                                                                                                             
ERROR: error compiling anonymous: could not load library "asdf"                                                                                                  cannot open shared object file: No such file or directory                                                                                                       

It should work as before.


ccall is not a method, which is why it comes up as undefined, it is handled specially in the compiler.
At least there is help for it, as many other things that people might look up are not (such as mutable, primitive, type, abstract), and the help for ? doesn’t mention it’s use as the ternary operator.
(something that hopefully can be addressed before v1.0, as I expect Julia will get a lot of new users after that is released)


Thanks for the response. Yes, I was using it wrong, and I was getting thrown off by the UndefVarError error, since 0.5.2 reports a different error.