title: Construct object on function ccall in Julia
body: <p>I am trying to simplify some binding to C but I am not sure if this is even possible, what I am trying to do is pass an array and expect to receive in a function so an object can be constructed by the type specified in the parameter or by ccall calling the correct convert function and initialize a struct object.</p>
  <p>Previous code, the bindings are full of <code>Vector3(v...)</code> and <code>Color(c...)</code>, is there a way to avoid this be automatic handling?</p>
  <pre class="lang-julia prettyprint-override"><code>drawline(startPos, endPos, color) = ccall((:DrawLine3D, &quot;my_lib&quot;), Cvoid, (Vector3,Vector3,Color), Vector3(startPos...), Vector3(endPos...), Color(color...))
  drawpoint([10,10,10],[100,100,100],[155,155,155,255]) # call example
  </code></pre>
  <p>Is it possible to reduce the code with something like this?:</p>
  <pre><code>struct Vector3
      x::Cfloat
      y::Cfloat
      z::Cfloat
      Vector3((x,y,z))=new(x,y,z)
  end
  #first attempt
  #trying to call the Vector3 constructor without calling explicitly
  drawpoint(startpos::Vector3,endpos::Vector3,color::Color) = ccall((:DrawPoint3D, &quot;my_lib&quot;), Cvoid, (Vector3,Vector3,Color), startpos,endpos,color) 
  
  #second attempt (should be the simplest way to go)
  #trying to receive arrays so ccall can convert from list or tuple to Struct object
  drawpoint(startpos,endpos,color) = ccall((:DrawPoint3D, &quot;my_lib&quot;), Cvoid, (Vector3,Vector3,Color), startpos,endpos,color) 
  </code></pre>
  <p>Is something like this even possible in Julia?</p>