vicfred has quit [Remote host closed the connection]
vicfred has joined #ocaml
tvn948 has quit []
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 240 seconds]
malc_ has joined #ocaml
malc_ has quit [Remote host closed the connection]
malc_ has joined #ocaml
malc_ has quit [Ping timeout: 256 seconds]
malc_ has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
malc_ has quit [Remote host closed the connection]
malc_ has joined #ocaml
NSA_Spy has quit [Remote host closed the connection]
NSA_Spy has joined #ocaml
mbuf has joined #ocaml
narimiran has joined #ocaml
NSA_Spy has quit [Ping timeout: 256 seconds]
_whitelogger has joined #ocaml
osa1 has joined #ocaml
dborisog has joined #ocaml
Serpent7776 has joined #ocaml
_whitelogger has joined #ocaml
rowbee has joined #ocaml
rowbee is now known as robi
snowpand_ has quit [Quit: Leaving...]
chripell has quit [Quit: ZNC 1.8.1+deb1 - https://znc.in]
chripell has joined #ocaml
nkly_ has joined #ocaml
bartholin has quit [Quit: Leaving]
jaar has joined #ocaml
mbuf has quit [Quit: Leaving]
mbuf has joined #ocaml
ggole has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
Haudegen has joined #ocaml
artart78 has quit [Ping timeout: 256 seconds]
inkbottle has quit [Ping timeout: 256 seconds]
zebrag has joined #ocaml
jbrown has quit [Ping timeout: 246 seconds]
jbrown has joined #ocaml
oriba has joined #ocaml
<oriba>
If I call C-functions from OCaml, do I have to use CAMLprim for the function that is called from OCaml? I have seen examples, where C-functions only have type value.
<def>
C-functions called from OCaml are restricted to taking and returning values
waleee-cl has joined #ocaml
aaaaaa has joined #ocaml
<oriba>
how to give back double-value from C to OCaml?
Haudegen has quit [Ping timeout: 264 seconds]
sagax has quit [Remote host closed the connection]
sagax has joined #ocaml
Haudegen has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
mbuf has quit [Quit: Leaving]
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 260 seconds]
vicfred has quit [Quit: Leaving]
vicfred has joined #ocaml
<flux1>
oriba: there's a C function that takes a C double, allocates a boxed ocaml-float and then returns that.. I don't recall if it might be valled Val_double or Double_val or something :)
<flux1>
at least I'm 98% sure there is :)
<oriba>
flux1: yes, found out that I have to use caml_alloc_float_array() for allocation (instead of caml_alloc()) and Store_double_field() instead of Store_field.
<oriba>
but IÄm not sure if I have to use Camllocal<n> for a value that I don't give back and just store into the result, which is given back.
<malc_>
flux1: caml_copy_double?
<flux1>
malc_: sounds very likely :)
<malc_>
tres bien
<flux1>
oriba: I believe you do need to use Camllocal for those values
<oriba>
but my value is a true C-double, not a value variable... Does Store_double_field(result, 0, Double_val(mydouble)) work with mydouble being a double[1] mydouble?
<flux1>
hmm, I think Double_val is intended to convert from OCaml values to C values, right?
<flux1>
so if mydouble is a C value, then it's not the right function to call
<flux1>
"Double_val(v) returns the floating-point number contained in value v, with type double." and "Store_double_field(v, n, d) stores the double precision floating-point number d in the nth element of the array of floating-point numbers v.", so the latter takes plain C doubles and stores them inside OCaml heap