# How to debug non-determinstic behavior involving ccall

**URL:** https://discourse.julialang.org/t/how-to-debug-non-determinstic-behavior-involving-ccall/21186
**Category:** General Usage
**Tags:** question, ccall, debug
**Created:** [February 25, 2019, 8:43pm UTC](https://discourse.julialang.org/t/how-to-debug-non-determinstic-behavior-involving-ccall/21186 "2019-02-25T20:43:26Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)
#### Post date: [February 26, 2019, 6:36am UTC](https://discourse.julialang.org/t/how-to-debug-non-determinstic-behavior-involving-ccall/21186/3 "2019-02-26T06:36:35Z")

</div>

You need special syntax for `ccall`ing C varargs functions. See:

> [@Wrote a macro to make ccall look a little more like Julia. Need an opinion on the return type placement](https://discourse.julialang.org/t/wrote-a-macro-to-make-ccall-look-a-little-more-like-julia-need-an-opinion-on-the-return-type-placement/19373/26):
>
> It has always been supported and this is the syntax. It doesn’t support mixing types though (llvm obviously support that just fine but we just don’t have a syntax for it…) I believe this is documented last time I check… Note that on x86 (64bit only iirc) vararg floating point is one of the few cases this is needed. The calling convention requires the number of fp vararg to be passed in rax so without the ... the result may be wrong.

So in this case,

```julia
function SCIPexprCreate(blkmem_, expr__, op, value)
    ccall((:SCIPexprCreate, libscip), SCIP_RETCODE,
          (Ptr{BMS_BLKMEM}, Ref{Ptr{SCIP_EXPR}}, SCIP_EXPROP, Cdouble...),
                                                              # Note ^^^
          blkmem_, expr__, op, value)
end

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-debug-non-determinstic-behavior-involving-ccall/21186)._
