rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Tuplanolla has quit [Quit: Leaving.]
pi3ce has joined #ocaml
pippijn has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pippijn has joined #ocaml
pippijn has quit [Ping timeout: 245 seconds]
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #ocaml
pippijn has joined #ocaml
pippijn has quit [Ping timeout: 246 seconds]
pippijn has joined #ocaml
rgrinberg has joined #ocaml
kristjansson has joined #ocaml
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #ocaml
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #ocaml
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #ocaml
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #ocaml
cr1901 has quit [Client Quit]
cr1901 has joined #ocaml
kristjansson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kristjansson has joined #ocaml
waleee has quit [Ping timeout: 245 seconds]
kristjansson has quit [Client Quit]
trev has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
<discocaml>
<omnisci3nt> gdi trying to link with some C code is driving me batty. even though the generated `.so` and `.a` definitely have a symbol I keep getting `exception Dl.DL_error("_build/default/bin/main.exe: undefined symbol: ...")`
<dh`>
why is it looking for the symbol in main.exe?
<discocaml>
<omnisci3nt> I'm calling a function from within my main.ml
<discocaml>
<omnisci3nt> that should execute a C function that I've wrapped in my `lib` with `foreign "blabla"` using Ctypes
<discocaml>
<omnisci3nt> that should execute a C function that I've wrapped in my `lib` with `foreign "blabla" (type @-> returning void)` using Ctypes
<dh`>
my question is: are you sure that the reason main.exe appears in the error message isn't that it's opening main.exe to look for the symbol instead of the .so file?
<discocaml>
<omnisci3nt> It could be I guess, there's very little useful information in the dune docs for how to set this up
<discocaml>
<omnisci3nt> I'd rather it be statically linked anyway but I've tried testing `(modes native)` and `(no_dynlink)` and it still wants both a `.a` *and* a `.so`
<dh`>
I successfully managed to use Ctypes for something a while back but afaicr it just worked
<discocaml>
<omnisci3nt> I have used it successfully before too but it seems like it was just magic or the way I set it up no longer works
<discocaml>
<omnisci3nt> last time I used `(foreign_archives foo)` and just copied `libfoo.a` into my `bin` directory and it worked
<dh`>
other things to check: make sure the symbol is tagged with the right visibility
<discocaml>
<omnisci3nt> I tried that but alas
<discocaml>
<omnisci3nt> last time (like 2 years ago?) I used `(foreign_archives foo)` and just copied `libfoo.a` into my `bin` directory and it worked
<dh`>
also try opening libfoo.so from python and see if that works, will rule out it itself being bust
<discocaml>
<omnisci3nt> yeah good idea.
<dh`>
also try strace/ktrace/etc if you have that available, that will tell you which file it's actually opening among other useful things
<discocaml>
<omnisci3nt> so using `nm` theyre showing `T` which should be publically exported symbols
<dh`>
you also need to check the dynamic visibility
<dh`>
e.g. with readelf -s
<discocaml>
<omnisci3nt> FUNC GLOBAL DEFAULT
<dh`>
hmm that should be ok
mima has joined #ocaml
<discocaml>
<omnisci3nt> I'm a bit confused because `foreign_archives` wants a `.a` and as far as I can tell by googling it means it gets statically lniked in, yet even if it compiles I get a DLOpen error when running `dune exec bin/main.exe` indicating its trying to dynlink to it. I think I need to set up a minimum replication repo and ask someone in #advanced-help or something.
<discocaml>
<omnisci3nt> I guess this is a #dune issue actually
azimut has joined #ocaml
mima has quit [Ping timeout: 252 seconds]
patrick__ is now known as patrick
szkl has joined #ocaml
Tuplanolla has joined #ocaml
patrick has quit [Killed (erbium.libera.chat (Nickname regained by services))]
patrick__ has joined #ocaml
Anarchos has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<discocaml>
<omnisci3nt> The OP observed that moving their `.c`, `.h` into the `/bin` folder and moving foreign declarations in main.ml worked ✅ . However, I don't think that's a particularly nice way of organising code.
<discocaml>
<omnisci3nt>
<discocaml>
<omnisci3nt> I wonder if given the fact that my old project worked when I had copied the `libfoo.a` into the `/bin` folder perhaps some functionality in either dune or ctypes-foreign has changed since then. If I can understand what's going on well enough I might try and make a template repository or a PR to the docs because it's kind of hidden knowledge on how to get it to work *unless* you already know how it works (the curse of a lot of OCaml tooling
<discocaml>
<omnisci3nt>
<discocaml>
<omnisci3nt> I will try the `dl.open` solution after dinner. It looks like using the stub generation or a different workflow is probably the better long-term play but that's an adventure for anther day...
<discocaml>
<omnisci3nt> The OP observed that moving their `.c`, `.h` into the `/bin` folder and moving foreign declarations in main.ml worked ✅ . However, I don't think that's a particularly nice way of organising code.
<discocaml>
<omnisci3nt>
<discocaml>
<omnisci3nt> I wonder if given the fact that my old project worked when I had copied the `libfoo.a` into the `/bin` folder perhaps some functionality in either dune or ctypes-foreign has changed since then. If I can understand what's going on well enough I might try and make a template repository or a PR to the docs because it's kind of hidden knowledge on how to get it to work *unless* you already know how it works (the curse of a lot of OCaml tooling
<discocaml>
<omnisci3nt>
<discocaml>
<omnisci3nt> I will try the `dl.open` solution after dinner! It looks like using the stub generation or a different workflow is probably the better long-term play but that's an adventure for anther day...
<discocaml>
<omnisci3nt> The OP observed that moving their `.c`, `.h` into the `/bin` folder and moving foreign declarations in main.ml worked ✅ . However, I don't think that's a particularly nice way of organising code.
<discocaml>
<omnisci3nt>
<discocaml>
<omnisci3nt> I wonder if given the fact that my old project worked when I had copied the `libfoo.a` into the `/bin` folder perhaps some functionality in either dune or ctypes-foreign has changed since then. If I can understand what's going on well enough I might try and make a template github repo or a PR to the docs because it's kind of hidden knowledge on how to get it to work *unless* you already know how it works (the curse of a lot of OCaml tooling
<discocaml>
<omnisci3nt>
<discocaml>
<omnisci3nt> I will try the `dl.open` solution after dinner! It looks like using the stub generation or a different workflow is probably the better long-term play but that's an adventure for anther day...
bartholin has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
patrick__ is now known as patrick
patrick is now known as Guest126
patrick__ has joined #ocaml
average has quit [Quit: Connection closed for inactivity]
bartholin has quit [Quit: Leaving]
bartholin has joined #ocaml
dnh has joined #ocaml
dnh has quit [Client Quit]
<discocaml>
<froyo> type t = ..
<discocaml>
<froyo> type t += private A
<discocaml>
<froyo> type t += B
<discocaml>
<froyo> this is cute
<discocaml>
<froyo> private at constructor level
dnh has joined #ocaml
<discocaml>
<_ggole> That's kinda nice
<discocaml>
<tjammer> ```
<discocaml>
<tjammer> ** Conflict (unexplainable) in state 143.
<discocaml>
<tjammer> ** Token involved: Rpar
<discocaml>
<tjammer> ** Please send your grammar to Menhir's developers.
<discocaml>
<tjammer> ```
<discocaml>
<tjammer> That's a new one
mima has joined #ocaml
mima has quit [Ping timeout: 260 seconds]
<discocaml>
<0aty> that's funny
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gentauro has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
gentauro has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 264 seconds]
waleee has joined #ocaml
azimut has joined #ocaml
<discocaml>
<gabyfle> Yow, I have some C files inside my project that is using dune for building. Does anyone knows if I can add `.c` and `.h` to be automatically formatted using the `dune fmt` command ?
<discocaml>
<gabyfle> Like by using `clang-format` for example
szkl has quit [Quit: Connection closed for inactivity]