# Does ccall still work in 0.6.1?

**URL:** <https://discourse.julialang.org/t/does-ccall-still-work-in-0-6-1/7190>\
**Category:** General Usage\
**Created:** [November 20, 2017, 1:58pm UTC](https://discourse.julialang.org/t/does-ccall-still-work-in-0-6-1/7190 "2017-11-20T13:58:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bgavin](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bgavin](https://discourse.julialang.org/u/bgavin)\
**Post date:** [November 20, 2017, 1:58pm UTC](https://discourse.julialang.org/t/does-ccall-still-work-in-0-6-1/7190/1 "2017-11-20T13:58:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [November 20, 2017, 2:09pm UTC](https://discourse.julialang.org/t/does-ccall-still-work-in-0-6-1/7190/2 "2017-11-20T14:09:07Z")

</div>

ccall is pretty special:

```julia
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"                                                                                                          
asdf.so: cannot open shared object file: No such file or directory                                                                                                       

```

It should work as before.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [November 20, 2017, 2:28pm UTC](https://discourse.julialang.org/t/does-ccall-still-work-in-0-6-1/7190/3 "2017-11-20T14:28:47Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![bgavin](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bgavin](https://discourse.julialang.org/u/bgavin)\
**Post date:** [November 20, 2017, 3:13pm UTC](https://discourse.julialang.org/t/does-ccall-still-work-in-0-6-1/7190/4 "2017-11-20T15:13:32Z")

</div>

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.
