<FromGitter>
<skinnyjames> Running into an interesting issue trying to work with libgit2 bindings - libgit2 passes the same payload of type`Void*` (https://libgit2.org/libgit2/#HEAD/type/git_remote_callbacks) to each remote callback when cloning - so to intercept each callback from crystal, I have to pass an object containing all the callbacks (essentially a `{} of String => AliasForCallbackFunctions`) for each type. Boxing the
<FromGitter>
... object and passing it through causes an `invalid memory access` error, whereas not passing it does not. I've been able to pass single boxed blocks for callback values so far, wondering what I might be doing wrong here.
xiamx has joined #crystal-lang
<FromGitter>
<oprypin:matrix.org> @skinnyjames: I'm fully sure that I could help you. also willing to do so. but can't look into it today. also maybe missing some details
<FromGitter>
<oprypin:matrix.org> why do you need to pass an object containing all callbacks? why not just pass a class instance with normal methods?
<FromGitter>
<skinnyjames> No worries! I'm noticing that it doesn't actually matter what value I send, so i think something might be wrong with the binding. Happy to provide more information tomorrow
<FromGitter>
<skinnyjames> I think I'm wanting the callbacks to be defined by the consumer of the lib.
<FromGitter>
<oprypin:matrix.org> @skinnyjames: what's the implementation of `on_credentials_acquire` ?
<FromGitter>
<oprypin:matrix.org> I'd think that it should be `@on_credentials_acquirw = block`
<FromGitter>
<oprypin:matrix.org> if so, that can be a getter on some object
<FromGitter>
<oprypin:matrix.org> and then you just box that object and pass that as Void*
<FromGitter>
<skinnyjames> for sure, I tried that too
<FromGitter>
<oprypin:matrix.org> then can we perhaps look at the code from when you tried this?
<FromGitter>
<skinnyjames> yeah one sec
<FromGitter>
<skinnyjames> I'm currently noticing that it blows up if I pass `Box.box("hello")` as the payload
<FromGitter>
<skinnyjames> so it is probably unrelated
<FromGitter>
<oprypin:matrix.org> weird 🤔 ⏎ how do you unbox? maybe there's just some basic mistake ¯\\\_(ツ)_/¯
<FromGitter>
<skinnyjames> it blows up without unboxing
<FromGitter>
<skinnyjames> I think the bindings might be messed up? (I'm definitely still learning
<FromGitter>
<oprypin:matrix.org> the thing is, if you box something, you need to store that persistently as an instance variable or whatever. so that could be what's missing
<FromGitter>
<oprypin:matrix.org> bindings could be messed up too, who knows
<FromGitter>
<skinnyjames> hmmm
<FromGitter>
<oprypin:matrix.org> if you could publish the code in a way that one can just run it and see the crash, that'd be quite a productive way to try to solve this. though i probably won't get to it today
<FromGitter>
<skinnyjames> yup! sorry it's pretty divergent at the moment, I'll clean it up and push a branch
<FromGitter>
<skinnyjames> Was trying to debug, so I commented out the specs
<FromGitter>
<skinnyjames> curious though what this means: `int (*)(git_remote_completion_t, void *)` in the context of a callback function. ⏎ I feel like I'm misinterpreting it