adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.08 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.08/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
AtumT has quit [Quit: AtumT]
kvda has joined #ocaml
keep_learning has joined #ocaml
q9929t has joined #ocaml
q9929t has quit [Quit: q9929t]
ross has joined #ocaml
ross has left #ocaml [#ocaml]
ross has joined #ocaml
olle has joined #ocaml
nullifidian_ has quit [Read error: Connection reset by peer]
nullifidian_ has joined #ocaml
mfp has quit [Ping timeout: 268 seconds]
zolk3ri has quit [Remote host closed the connection]
tormen has joined #ocaml
olle has quit [Ping timeout: 240 seconds]
tormen_ has quit [Ping timeout: 245 seconds]
rople has joined #ocaml
ross has left #ocaml [#ocaml]
ross_pure has joined #ocaml
<ross_pure> Is someone here familiar with calling into ocaml from c? I have some c functions that call into ocaml but their return values seem to get clobbered after some more function calls, I presume by the GC, but I think I have used all of the CAMLparam, CAMLlocal and CAMLreturn macros (in c) where I need to - do I need to do anything else to make sure that the GC knows I'm using these values inside c?
rople has quit [Ping timeout: 246 seconds]
rople has joined #ocaml
vicfred has quit [Ping timeout: 268 seconds]
vicfred has joined #ocaml
gravicappa has joined #ocaml
jao has quit [Remote host closed the connection]
jao has joined #ocaml
jao has quit [Ping timeout: 246 seconds]
mbuf has joined #ocaml
narimiran has joined #ocaml
malina has quit [Remote host closed the connection]
_whitelogger has joined #ocaml
unyu has joined #ocaml
ziyourenxiang has quit [Quit: Leaving]
crowley95 has quit [Ping timeout: 258 seconds]
vicfred has quit [Quit: Leaving]
<pino|work> ross_pure: i have some (basic) experience with that, although i'm definitely not an expert
<pino|work> ross_pure: can you please pastebin/link the code you wrote for that?
<ross_pure> pino|work: Thanks for the response - here is a pastebin to part of the c code https://pastebin.com/jvp864uu (values that get returned from this function seem to get clobbered)
<ross_pure> I would rather not give all of the code but if there are other parts (do you want to see any of the ocaml side?) that you want to look at let me know
<pino|work> ross_pure: i don't think you need to use caml_register_global_root, as the value is already declared as CAMLlocal
<ross_pure> ah yes that is an artifact from me trying some things on the off chance that they would work
<pino|work> (especially because you never unregister it then)
<pino|work> also, you don't need to caml_alloc it before
<ross_pure> yeah I also didn't originally have the allocs but again I was just trying stuff
<pino|work> printf("[c] commitment header = %llx\n", ((long long*)(commitment_val))[-1]);
<pino|work> i think there's a macro for this... Tag_val()
<pino|work> what's the result of it?
<ross_pure> [c] commitment header = 1300
<pino|work> can you please also pastebin the definition of the Commitment struct?
<ross_pure> I'll try Tag_val(), one sec
<ross_pure> sure
<ross_pure> (it just wraps the value)
<pino|work> (ah, and make the 'closure' variable as const, otherwise this code will fail to build with ocaml 4.09)
<ross_pure> Interesting, Tag_val() prints 0
<pino|work> Tag_val(commitment_val), right?
<ross_pure> yep
<pino|work> i think that means it's a block
<ross_pure> Though I think that makes sense because it looks like Tag_val casts to an unsigned char* so it would only get the 00 part of 1300
<pino|work> i see you store the result as value, so you need to use caml_register_global_root() indeed, but only after setting it in the Commitment struct
<pino|work> what's the signature of the ocaml 'commit' function?
mbuf has quit [Ping timeout: 268 seconds]
<ross_pure> it's t -> t where t is a Field.t array, and Field.t is defined in the Snarky library https://github.com/o1-labs/snarky
<ross_pure> (i know that this array is going to have 4 elements)
<ross_pure> Also why would I need to call the register function after setting it in my c struct? I thought you just had to call it immediately after you set the value
<pino|work> commitment.inner = commitment_val; <- this is setting it
<ross_pure> actaully yeah that makes sense nevermind
<pino|work> sorry, i mean you have to register the struct field as global root, not the local variable
amiloradovsky has joined #ocaml
rople has quit [Ping timeout: 276 seconds]
<pino|work> remember to use caml_remove_global_root when you dispose the struct
<ross_pure> Does it matter that the commitment.inner variable never passes through the CAMLlocal macro? Is it even possible to properly set up a struct field using one of the macros?
<pino|work> yes, that's why you need to register that value as global root
<pino|work> s/need/must/
<ross_pure> ok yep that was definitely a problem
<pino|work> (in addition to ^, i suggest also https://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.html as nice-and-easy doc)
<ross_pure> Thanks for that second link, hadn't come across that one yet
<pino|work> ross_pure: any luck?
<ross_pure> pino|work: not yet, still getting seg faults :(
<pino|work> any gdb backtrace? did you try with valgrind?
<ross_pure> no haven't looked at using gdb yet; I had a simple example working but this larger program is not, which I think is because my values are pointing to the minor heap and then after some expensive computations they get moved into the major heap but the values that are being held in c don't get updated
<ross_pure> if you're interested, here's a paste of what the values are pointing to, which is the reason for my theory https://pastebin.com/wdaCAujY
<ross_pure> it looks like the memory later has block headers in the moddle of where the array elements used to be
barockobamo has joined #ocaml
bartholin has quit [Remote host closed the connection]
ziyourenxiang has joined #ocaml
rople has joined #ocaml
rople has quit [Client Quit]
rople has joined #ocaml
amiloradovsky has quit [Ping timeout: 246 seconds]
mbuf has joined #ocaml
Haudegen has joined #ocaml
malina has joined #ocaml
_whitelogger has joined #ocaml
ggole has joined #ocaml
ross_pure has quit [Quit: Lost terminal]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kakadu_ has joined #ocaml
<Leonidas> companion_cube: yes. I ended up doing my own redis binding since I looked at the code and decided it was cursed ;-)
pino|work has quit [Quit: brb]
pino|work has joined #ocaml
cartwright has quit [Remote host closed the connection]
cartwright has joined #ocaml
user___ has joined #ocaml
crowley95 has joined #ocaml
mfp has joined #ocaml
nullifidian_ has quit [Read error: Connection reset by peer]
nullifidian has joined #ocaml
Netsu has joined #ocaml
<Netsu> Can I [@derive something] for type included from other module?
<Netsu> E.g. for type M.t make instance for B.t where B = struct include M end
vyorkin has joined #ocaml
<Netsu> and call B.t_something_derived
<Netsu> is it possible?
<octachron> Not directly, ppxs are syntactic they would know nothing of the type of M.
<octachron> You can re-export the type, derive some functions and then include the module M without the type that you already defined
<vyorkin> what is get_shard_id in ounit?
<vyorkin> > OUnit2.get_shard_id
<Netsu> octachron: but functions in original module would work only with own type there, and would be incompatible with new one then, I guess
kakadu has joined #ocaml
<Netsu> however maybe it could be done with ppx_import
kakadu_ has quit [Ping timeout: 240 seconds]
<octachron> Netsu, by re-exporting type I meant `type 'a opt = 'a option = None | Some of 'a`. You don't lose type equality in this case.
vyorkin has quit [Remote host closed the connection]
rople has quit [Quit: rople]
rople has joined #ocaml
zolk3ri has joined #ocaml
vyorkin has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
freyr69 has joined #ocaml
rople has quit [Quit: rople]
rople has joined #ocaml
RalfJ has quit [Ping timeout: 252 seconds]
kvda has joined #ocaml
picolino has quit [Ping timeout: 268 seconds]
picolino has joined #ocaml
ygrek has joined #ocaml
rople has quit [Ping timeout: 246 seconds]
RalfJ has joined #ocaml
picolino has quit [Ping timeout: 244 seconds]
picolino has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
malina has quit [Remote host closed the connection]
GreyFaceNoSpace has joined #ocaml
Haudegen has joined #ocaml
GreyFaceNoSpace has quit [Client Quit]
<companion_cube> Leonidas: oh. are these bindings public?
jao has joined #ocaml
laudecay has joined #ocaml
laudecay has quit [Changing host]
laudecay has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
spew has joined #ocaml
ygrek has joined #ocaml
<companion_cube> (I imagine it's based on async, though)
<companion_cube> ah, it's orewa
<companion_cube> oh well, can't use that…
laudecay has quit [Ping timeout: 245 seconds]
laudecay has joined #ocaml
laudecay has joined #ocaml
laudecay has quit [Changing host]
ygrek has quit [Ping timeout: 240 seconds]
q9929t has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
yorick has joined #ocaml
<yorick> so I have dune build -p something in a multi-package, but it can't find the dependencies for it somehow
freyr69 has quit [Remote host closed the connection]
<yorick> so it can't find the libraries if they are in the same workspace
q9929t has quit [Quit: q9929t]
<yorick> this works without -p
<yorick> (but it builds too much)
vyorkin has quit [Quit: WeeChat 2.5]
vyorkin has joined #ocaml
vyorkin` has joined #ocaml
ziyourenxiang has quit [Ping timeout: 276 seconds]
lostman has joined #ocaml
olle has joined #ocaml
Netsu has quit [Ping timeout: 260 seconds]
barockobamo has quit [Ping timeout: 244 seconds]
olle has quit [Remote host closed the connection]
RalfJ has quit [Remote host closed the connection]
RalfJ has joined #ocaml
pino|work has quit [Quit: brb]
pino|work has joined #ocaml
laudecay has quit [Ping timeout: 240 seconds]
laudecay has joined #ocaml
Haudegen has joined #ocaml
AtumT has joined #ocaml
Serpent7776 has joined #ocaml
mbuf has quit [Quit: Leaving]
AtumT_ has joined #ocaml
AtumT has quit [Read error: Connection reset by peer]
gravicappa has quit [Ping timeout: 240 seconds]
vyorkin` has quit [Remote host closed the connection]
vyorkin has quit [Ping timeout: 246 seconds]
laudecay has quit [Ping timeout: 268 seconds]
gravicappa has joined #ocaml
AtumT_ has quit [Quit: AtumT_]
gareppa has joined #ocaml
jnavila has joined #ocaml
ravenousmoose has joined #ocaml
ggole has quit [Quit: Leaving]
gareppa has quit [Quit: Leaving]
vyorkin has joined #ocaml
gravicappa has quit [Ping timeout: 268 seconds]
keep_learning has quit [Remote host closed the connection]
laudecay has joined #ocaml
laudecay has quit [Changing host]
laudecay has joined #ocaml
laudecay has quit [Ping timeout: 246 seconds]
cartwright has quit [Remote host closed the connection]
cartwright has joined #ocaml
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kakadu_ has joined #ocaml
bartholin has joined #ocaml
klntsky has quit [Remote host closed the connection]
klntsky has joined #ocaml
narimiran has quit [Ping timeout: 240 seconds]
Hrundi_V_Bakshi has joined #ocaml
vyorkin has quit [Ping timeout: 246 seconds]
laudecay has joined #ocaml
laudecay has quit [Ping timeout: 244 seconds]
<Leonidas> companion_cube: in all fairness, I think making orewa support lwt is probably easier than fixing up the ocaml-redis bindings
Serpent7776 has quit [Quit: leaving]
<companion_cube> I also use the sync version
vyorkin has joined #ocaml
lostman has quit [Quit: Connection closed for inactivity]
jnavila has quit [Remote host closed the connection]
AtumT has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
malina has joined #ocaml
vicfred has joined #ocaml
nullifidian_ has joined #ocaml
nullifidian has quit [Read error: Connection reset by peer]
kjak has quit [Ping timeout: 246 seconds]
kjak has joined #ocaml
RalfJ has quit [Remote host closed the connection]
RalfJ has joined #ocaml
laudecay has joined #ocaml
laudecay has joined #ocaml
laudecay has quit [Changing host]
laudecay has quit [Ping timeout: 268 seconds]
ross_pure has joined #ocaml
Hrundi_V_Bakshi has quit [Ping timeout: 245 seconds]
yassine has joined #ocaml
yassine has quit [Client Quit]
spew has quit [Quit: Connection closed for inactivity]
Haudegen has quit [Ping timeout: 245 seconds]
AtumT has quit [Quit: AtumT]
kvda has joined #ocaml
ziyourenxiang has joined #ocaml