Skip to content

Instantly share code, notes, and snippets.

@axsk
Created August 25, 2018 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axsk/748cfd41a529c9c9b76d23c1a10da93d to your computer and use it in GitHub Desktop.
Save axsk/748cfd41a529c9c9b76d23c1a10da93d to your computer and use it in GitHub Desktop.
using Sundials
function test1()
yS0 = [1. 2. 3.; 4. 5 6]
N, Ns = size(yS0)
GC.@preserve yS0n = [Sundials.NVector(yS0[:,j]) for j=1:Ns] # array of julia wrappers
GC.@preserve yS0nv = [Sundials.N_Vector(n) for n in yS0n] # array of pointers to sund. structs
pyS0 = pointer(yS0nv)
@show ps = unsafe_wrap(Array, pyS0, Ns)
@show a = Sundials.asarray(ps[1])
end
@axsk
Copy link
Author

axsk commented Aug 25, 2018

this segfaults

adding a @show in front of line 8 makes it run through...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment