<ihavelotsoffries>
that is from ctypes. structured is a structured is a polymorphic record with field structured that is a ptr to a structured and so far?
<ihavelotsoffries>
wouldn't that make it infinity recursive?
<CcxWrk>
Just guessing, but I assume ptr breaks the recursion (by possibly being NULL, or referring to some item in a cyclical way )
<CcxWrk>
But I think there's more to it.
<ihavelotsoffries>
well, if it can be null, the it can't encode much, can it?
<ihavelotsoffries>
It has be a lil confused.
zv has quit [Quit: WeeChat 2.2]
gravicappa has joined #ocaml
<CcxWrk>
Is this generated by ctypes or is this from ctypes proper? If the former, what is the C counterpart?
cobreadmonster has quit [Quit: Connection closed for inactivity]
pera has quit [Ping timeout: 252 seconds]
wklm has joined #ocaml
tane has joined #ocaml
wklm has quit [Ping timeout: 244 seconds]
picolino has quit [Ping timeout: 252 seconds]
ihavelotsoffries has quit [Ping timeout: 248 seconds]
picolino has joined #ocaml
freyr69 has joined #ocaml
wklm has joined #ocaml
Haudegen has joined #ocaml
gahr_ is now known as gahr
dhil has joined #ocaml
ShalokShalom has joined #ocaml
<hannes>
in real world ocaml, the binary representation of variants (and polyvars) is explained, which is fine. is there some similar documentation for GADTs?
<Drup>
hannes: it's the same one
<hannes>
Drup: thanks!
mfp has joined #ocaml
<freyr69>
I need help with OCaml ffi
<freyr69>
I receive callbacks in C function, store them in a tuple and return this tuple with CAMLreturn
<freyr69>
However GC collects them
<freyr69>
Why and what should I do?
<zozozo>
freyr69: do you store them somewhere aside from the tuple that you return ?
<zozozo>
if the tuple becomes unreachable, it's expected that the callbacks would be collected along the tuple
<pgiarrusso>
most GCs don't look for references on the C heap, so they don't know you have a reference there
<pgiarrusso>
you usually need to call some GC API to inform the GC that something is referred to on the C side
<pgiarrusso>
Worse, the C code is not happy if the GC moves stuff, so you also need some solution for that
<freyr69>
zozozo: nope
<pgiarrusso>
*dunno in OCaml*, but is it any different?
<zozozo>
freyr69: well then, why is it a problem is the callbacks are collected if they are unreachable ?
<pgiarrusso>
freyr69: apart from that should work if the writes to the OCaml heap are done properly, meaning, apparently, with Store_field
<pgiarrusso>
Otherwise you risk problems
kotrcka has quit [Ping timeout: 252 seconds]
<pgiarrusso>
In the GCs I have in mind, the problems might happen seldom, so "it seems to work" isn't a strong guarantee :-(
kotrcka has joined #ocaml
<freyr69>
pgiarrusso: btw is there any way to store OCaml data in C code?
<freyr69>
So the GC wouldn't move or collect value?
<freyr69>
for example callback?
<pgiarrusso>
This seems relevant: > Rule 4 Global variables containing values must be registered with the garbage collector using the caml_register_global_root function.
<pgiarrusso>
Because it sounds like what I described at the beginning (tho it wasn't relevant to your problem)
jaar has joined #ocaml
<freyr69>
pgiarrusso: Aha, does it mean that after that I could safely use a pointer to this variable from C til I unregister it?
Birdface has quit [Ping timeout: 248 seconds]
<flux[m]>
yes. registering it as a root means the GC won't move it.
<flux[m]>
copying OCaml values to C heap has the problem that pointers from such data to OCaml heap could become invalid at some point
<freyr69>
flux[m]: So is it safe to store a reference to an OCaml value in C, if it was registered?
<flux[m]>
freyr69: yes
tane has quit [Remote host closed the connection]
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom has joined #ocaml
silver has joined #ocaml
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom has joined #ocaml
zolk3ri has joined #ocaml
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom_ has joined #ocaml
tane has joined #ocaml
<Leonidas>
Unregistered copy of HyperOCam2
ShalokShalom_ has quit [Read error: Connection reset by peer]
ggole has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 250 seconds]
zolk3ri has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 248 seconds]
dhil has joined #ocaml
spew has joined #ocaml
<freyr69>
What could cause segfault in caml_oldify_local_roots, bad roots?
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
gravicappa has quit [Ping timeout: 248 seconds]
Facebird has joined #ocaml
Birdface has quit [Ping timeout: 264 seconds]
weird_error has joined #ocaml
kakadu_ has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
oni-on-ion has joined #ocaml
dtornabene has quit [Quit: Leaving]
dhil has quit [Ping timeout: 245 seconds]
jnavila has joined #ocaml
Haudegen has joined #ocaml
jnavila has quit [Ping timeout: 245 seconds]
porcupine has quit [Quit: Leaving]
jnavila has joined #ocaml
weird_error has quit [Quit: weird_error]
zolk3ri has quit [Remote host closed the connection]
zolk3ri has joined #ocaml
Serpent7776 has quit [Quit: leaving]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
Facebird has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Leaving]
[rg] has joined #ocaml
clog has quit [Ping timeout: 244 seconds]
clog has joined #ocaml
jnavila has quit [Remote host closed the connection]
<[rg]>
hate to be that guy, but why ocaml?
zolk3ri has quit [Quit: leaving]
kakadu_ has quit [Remote host closed the connection]
<oni-on-ion>
why what ?
<oni-on-ion>
why "[rg]"?
<oni-on-ion>
the name itself comes from Objective-CAML, from CAML, from ML, from ...
<oni-on-ion>
the choice itself as a professional development toolchain is very particular about the circumstances. ie. boats for water, trucks for haulin, cars for racin
<[rg]>
so the thing for ocaml is that it is object like, or are there other things
<[rg]>
also which resource to start with in ocaml?
[rg] has quit [Read error: Connection reset by peer]
oni-on-ion has quit [Ping timeout: 248 seconds]
Haudegen has quit [Remote host closed the connection]