# Ccall with return vector\<double\>

**URL:** https://discourse.julialang.org/t/ccall-with-return-vector-double/12631
**Category:** General Usage
**Tags:** question
**Created:** [July 24, 2018, 9:38am UTC](https://discourse.julialang.org/t/ccall-with-return-vector-double/12631 "2018-07-24T09:38:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![stakaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stakaz/32/4740_2.png) [@stakaz](https://discourse.julialang.org/u/stakaz)
#### Post date: [July 24, 2018, 9:38am UTC](https://discourse.julialang.org/t/ccall-with-return-vector-double/12631/1 "2018-07-24T09:38:42Z")

</div>

Hello, I have a function in a shared library (self-written) where I have a `vector<double>` as a return type. Now, how would I organize the `ccall` in order to get a `Array{Float64} in Julia.

I cannot figure it out on my own. Any help would be great. Thanks.

I tried:

```julia
ccall((:func_name, "path/to/file.so"), Ptr{Cdouble}, ())

```

But thid does not work and troughs a SegFault.

---

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [July 24, 2018, 1:08pm UTC](https://discourse.julialang.org/t/ccall-with-return-vector-double/12631/2 "2018-07-24T13:08:48Z")

</div>

`vector<double>` is a C++ type, so presumably you’re wrapping a C++ library, not a C library. Ccall only works for C libraries, which is why you’re having problems. You’ll need to either write a C-compatible wrapper for your C++ library or use [GitHub - JuliaInterop/Cxx.jl: The Julia C++ Interface](https://github.com/Keno/Cxx.jl)

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [July 24, 2018, 1:44pm UTC](https://discourse.julialang.org/t/ccall-with-return-vector-double/12631/3 "2018-07-24T13:44:09Z")

</div>

Or CxxWrap:

[https://github.com/JuliaInterop/CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl)
