What do you get it you use x1=Cdouble[2.0] instead?
2014/1/3 Andreas Lobinger <[email protected]> > Hello colleagues, > > many thanks for the previous postings, however i still miss something... > > My example, test_julia_u1.jl > > x1 = Cfloat[2.0]; > dump(x1); > ccall((:u1,"./u1.so"),Void,(Ptr{Float64},),x1); > dump(x1); > > calls u1.c / u1.so > > void u1(double *x) { > *x += 1.0; } > > Rather unexpected is the 0 output: > > lobi@m2:~/juliarepo$ ../julia/julia test_julia_u1.jl > Array(Float32,(1,)) [2.0f0] > Array(Float32,(1,)) [0.0f0] > > especially because c does it: > > lobi@m2:~/juliarepo$ ./test_main_u1 > 3.000000 2.000000 > > with > > #include <stdio.h> > > void main() { > double c,d; > c = 2.0; > d = c; > u1(&c); > printf("%f %f",c,d); } > > ? > -- Med venlig hilsen Andreas Noack Jensen
