<Smerdyakov>
I'm trying to, in the repl, #load a library that relies on some external C functions. What's the easiest way to do this without recompiling the repl executable?
<Smerdyakov>
(Recompiling to include the .o file with those functions, I mean.)
brwill_zzz is now known as brwill
brwill is now known as brwill_out
<Smerdyakov>
Does anyone know how to make all functions defined in a C .o file accessible as external functions from the ocaml toplevel repl?
<teratorn>
i don't think you want to use the .o files
<teratorn>
probably the final .so
<Smerdyakov>
I only have .o files.
<Smerdyakov>
One .o file with 8 or so functions, needed by a teeny bit of a library I want to play with.
<teratorn>
why?
<teratorn>
you ought to be able to compile your source file with gcc -shared
<teratorn>
and output that to an .so file
<Smerdyakov>
OK, so what do I do if I have a .so?
<teratorn>
but i don't know crap about the ocaml-C interface :(
<Smerdyakov>
Soooo.... you have suggested .so's without having any reason to think I can deal with them more easily for this?
<mattam>
ocamlmktop ?
<Smerdyakov>
mattam, I've run it with the .o file as an argument, along with -custom, and that doesn't seem to do it.
<mattam>
-dlllib maybe
<mattam>
with the so, it should work
<Smerdyakov>
Yikes! Error on dynamically loaded library: ./dllfloat.so: ELF file's phentsize not the expected size
<mattam>
what's a phentsize ?
<Smerdyakov>
I don't know. :-(
jewel has joined #ocaml
<Smerdyakov>
What is the proper command line to create a .so file from a .c file with gcc?
<mattam>
ld -shared -o object.so object.o
<Smerdyakov>
Oh. Tricky!
<mattam>
uh, a c file: gcc -shared -o object.so object.c, but i guess you guessed :)
<Smerdyakov>
Well, I've built the toplevel, but it says it can't find the .so file, which is in the current directory and /usr/local/lib. :-(
<mattam>
with -dllpath . it could get even better
<Smerdyakov>
Ah. Now it loads. We'll see if the functions are available. :)
<Smerdyakov>
It does!
* Smerdyakov
kisses mattam.
<Xcalibor>
Smerdyakov: have you compiled the files with -fPIC? you have to tell the compiler to generate Position Independent Code in order to build a -shared library with gcc...
<mattam>
thanks Smerdyakov :)
<Smerdyakov>
Xcalibor, I don't care. :P
<Xcalibor>
Smerdyakov: they probably were compiled with -fPIC or -fpic... try to make a file foo.o and also make a file yourlib.so and see what it says
<Xcalibor>
:)
<Smerdyakov>
NO! I want crashes!
jewel has quit ["bedtime"]
vect is now known as gl
gl is now known as vect
<Xcalibor>
you want crashes?
__DL__ has quit [Remote closed the connection]
polin8 has joined #ocaml
Kinners has joined #ocaml
polin8_ has joined #ocaml
polin8 has quit [Read error: 104 (Connection reset by peer)]
polin8_ is now known as polin8
polin8 has quit [Client Quit]
polin8 has joined #ocaml
polin8 has quit [Read error: 54 (Connection reset by peer)]
polin8 has joined #ocaml
* Xcalibor
leaves to bed... laters ad thanks!
Xcalibor has quit ["Terminando cliente"]
jdrake has joined #ocaml
<jdrake>
MOOF!
brwill_out is now known as brwill_zzz
jdrake has quit ["Oops. This machine just fell asleep"]
Kinners has left #ocaml []
klamath has quit []
jdmarshall has joined #ocaml
bk_ has joined #ocaml
whee has quit ["Leaving"]
srv has joined #ocaml
Nate1975 has joined #ocaml
__DL__ has joined #ocaml
Nate1975 has quit ["using sirc version 2.211+KSIRC/1.2.4"]
Nate1975 has joined #ocaml
bk_ has quit ["I'll be back"]
mellum has quit [Read error: 110 (Connection timed out)]
foxster has joined #ocaml
srv has quit ["Bye"]
<phubuh>
how can i find out where an exception was thrown?
<mrvn>
phubuh: catch it
<phubuh>
yeah, i could put catches everywhere it could be thrown, but isn't there a more scalable way? :/
<Smerdyakov>
Look in the Documentation section at the right of the page.
<Smerdyakov>
Oh, actually, it has its own section. :)
Demitar has joined #ocaml
<jdmarshall>
Ah. Right. Are those suitable for when I break something and I'm trying to figure out what I did wrong? I guess what I'm really looking for is a troubleshooting guide, now that I think about it.
Demitar has quit ["Bubbles everywhere!"]
bk_ has quit ["I'll be back"]
<Xcalibor>
troubleshooting should use compiler errors