kaustuv changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
Associat0r has quit []
ikaros has quit ["Leave the magic to Houdini"]
Associat0r has joined #ocaml
slash_ has quit [Client Quit]
willb1 has quit [Read error: 104 (Connection reset by peer)]
willb1 has joined #ocaml
ched_ has joined #ocaml
Ched has quit [Read error: 110 (Connection timed out)]
<ellisbben> question: is the use of exceptions for e.g. breaking a loop accepted practice?
<Alpounet> exceptions should be used in exceptional cases, IMO, but they are sometimes used that way.
<ellisbben> I can agree with that principle.
<Alpounet> My point is that if a library you may depend on uses this principle (an exception raised e.g when reaching the end of the file), then you have no choice... But I personnally wrap such exception usage in functions that handle that properly, so that I do not care anymore about this exception in the rest of the code.
<Alpounet> If there isn't such stuffs in library you use, then I think you should keep yourself from using such practice.
<ellisbben> right... I was mainly curious about the use of exceptions as non-local control structures
<ellisbben> having heard that ocaml exceptions are reasonably fast
<Alpounet> Exceptions may be used when a socket can't get connected to a server, e.g. In cases where the program ... well, would have hard to go on.
<Alpounet> But that's my point of view, not anyone shares it.
<Alpounet> ellisbben, from my point of view, using option is better.
<Alpounet> (for example)
<ellisbben> right, but that's for something that might give a value or might not
<ellisbben> my use case is iterating through a queue and stopping partway under certain conditions
<Alpounet> instead of raising End_of_file, your read function may return a string option... If it's Some s, then <do anything you want with s>, if it's None, then nothing to read anymore.
<ellisbben> it's good to know about option... thank you.
<Alpounet> ellisbben, but keep in mind that's the way I would do, not an absolute truth about exceptions etc in OCaml
<ellisbben> don't worry, I'm capable of holding my own opinions. :)
willb1 has quit [Read error: 54 (Connection reset by peer)]
willb1 has joined #ocaml
giulianoxt has joined #ocaml
willb1 has quit [Read error: 54 (Connection reset by peer)]
willb1 has joined #ocaml
giulianoxt has left #ocaml []
sporkmonger has joined #ocaml
ellisbben has quit ["Get MacIrssi - http://www.sysctl.co.uk/projects/macirssi/"]
willb1 has quit [Read error: 54 (Connection reset by peer)]
willb1 has joined #ocaml
Alpounet has quit [Remote closed the connection]
<palomer> yay for exceptions vs options !
<det> options ftw :-)
<det> I _hate_ how options are used in Ocaml stdlib
<det> If, I have a function "Map.sub: 'a map -> 'a -> 'b option", then I know exactly how to handle failure
<det> it is is just 'a -> 'b, then I have to lookup the exception to be raised
<det> the resulting code is uglier
<det> and you often have to convert to an option to preserve tail recursion, anyways
<det> I hear batteries offers both styles
<det> and I think exceptions are more efficient when not used in a way that breaks tail recursion
<det> "<det> I _hate_ how options are used in Ocaml stdlib", I mean exceptions, of course
<hcarty> det: Batteries has a rather nice (and hopefully complete?) "Exceptionless" suite of modules
<det> "<det> I hear batteries offers both styles"
<det> :-)
<det> nice to hear a confirmation, though
<hcarty> det: Yes, sorry - that simply meant for confirmation :-)
<hcarty> s/that/that was/
<det> It would be nice if Ubuntu 9.10 shipped with batteries
<det> Which I think means, that if debian has it now, it will
sporkmonger has quit []
mpwd has quit []
iskaldur has joined #ocaml
<iskaldur> is there a way to access a field's records via a function?
<iskaldur> ^^a record's fields
<iskaldur> for instance, if i have a record foobar = {x:int; y:int}, is there some kind of "my_function foobar x" that's equivalent to "foobar.x"?
<det> type r = { a : int; b : int; }
<det> # let f {a=a; b=b} = a + b;;
<det> val f : r -> int = <fun>
<det> # f {a=1; b=2};;
<det> - : int = 3
<det> You mean like that ?
mpwd has joined #ocaml
<det> If that is what you mean, then that is called "pattern matching".
BiDOrD has quit [Read error: 110 (Connection timed out)]
<iskaldur> oh, duh
<iskaldur> yep
<iskaldur> but there's no built in function?
<iskaldur> (e.g., i was initially wondering if the dot was a function :), so i could do something like (.) foobar "x")
mpwd_ has joined #ocaml
iskaldur has quit []
<jeff_s_> if . doesn't work (probably doesn't), you could write an equivalent
<det> . cant be a function
mpwd has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
mpwd_ has quit [Read error: 104 (Connection reset by peer)]
mpwd has joined #ocaml
Alpounet has joined #ocaml
mpwd_ has joined #ocaml
Alpounet has quit [Remote closed the connection]
willb1 has quit [Read error: 104 (Connection reset by peer)]
mpwd has quit [Read error: 110 (Connection timed out)]
Jedai has quit ["KVIrc Insomnia 4.0.0, revision: , sources date: 20090115, built on: 2009/03/07 00:45:02 UTC http://www.kvirc.net/"]
seafood has joined #ocaml
aym has joined #ocaml
mpwd_ has quit [Read error: 104 (Connection reset by peer)]
mpwd has joined #ocaml
willb1 has joined #ocaml
Camarade_Tux has joined #ocaml
Associat0r has quit []
schme has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
jeanbon has joined #ocaml
mpwd_ has joined #ocaml
mpwd has quit [Connection reset by peer]
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has joined #ocaml
aym has quit []
Jedai has joined #ocaml
Lomono_ has joined #ocaml
Lomono has quit [Read error: 60 (Operation timed out)]
ikaros has joined #ocaml
Associat0r has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
yziquel has joined #ocaml
julm has joined #ocaml
<yziquel> hi. is there an example somewhere of how to bind C++ objects to ocaml objects...?
<Camarade_Tux> yziquel, yeah, basically you have to put
<Camarade_Tux> extern "C" {
<Camarade_Tux> ...
<Camarade_Tux> }
<Camarade_Tux> around them
ched_ has quit [Read error: 60 (Operation timed out)]
mpwd_ has quit []
Associat0r has quit []
<Camarade_Tux> hmmm, batteries' configure checks that batteries is not already installed, that doesn't work well when you want to recompile and reinstall a godi package
<Camarade_Tux> especially when godi doesn't want to remove it
|aymeric| has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
Amorphous has quit ["shutdown"]
|aymeric| is now known as aym
mpwd has joined #ocaml
Jedai has quit [Read error: 110 (Connection timed out)]
Jedai has joined #ocaml
oriba has joined #ocaml
oriba has quit [Read error: 104 (Connection reset by peer)]
BiDOrD has joined #ocaml
boscop has joined #ocaml
<yziquel> Camarade_Tux: OK. but is there a way to map properly the object structure of a C++ object to an OCaml one?
<flux> yziquel, well, there is swik
<flux> it comes with a syntax extension that maps c++ objects to ocaml
<flux> pretty nifty [disclaimer only read the docs, never, used it]
<Camarade_Tux> I don't think there is a direct way but code generation might do it
<yziquel> flux: swig, you mean?
<flux> ah, right
<yziquel> flux, Camarade_Tux: will have a look at that...
yziquel has left #ocaml []
yziquel has joined #ocaml
Yoric[DT] has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
komar_ has joined #ocaml
bla has quit [Read error: 110 (Connection timed out)]
jeff_s_ has quit [Read error: 104 (Connection reset by peer)]
Jedai has quit [hubbard.freenode.net irc.freenode.net]
rjones__ has quit [hubbard.freenode.net irc.freenode.net]
ertai has quit [hubbard.freenode.net irc.freenode.net]
poucet has quit [hubbard.freenode.net irc.freenode.net]
bacam has quit [hubbard.freenode.net irc.freenode.net]
ozzloy has quit [hubbard.freenode.net irc.freenode.net]
Camarade_Tux has quit [hubbard.freenode.net irc.freenode.net]
pizza_ has quit [hubbard.freenode.net irc.freenode.net]
det has quit [hubbard.freenode.net irc.freenode.net]
mrvn has quit [hubbard.freenode.net irc.freenode.net]
brendan has quit [hubbard.freenode.net irc.freenode.net]
Asmadeus has quit [hubbard.freenode.net irc.freenode.net]
tomaw has quit [hubbard.freenode.net irc.freenode.net]
Snark has quit [hubbard.freenode.net irc.freenode.net]
noj has quit [hubbard.freenode.net irc.freenode.net]
mal`` has quit [hubbard.freenode.net irc.freenode.net]
BiDOrD has quit [hubbard.freenode.net irc.freenode.net]
gl has quit [hubbard.freenode.net irc.freenode.net]
authentic has quit [hubbard.freenode.net irc.freenode.net]
jeanbon has quit [hubbard.freenode.net irc.freenode.net]
holgr has quit [hubbard.freenode.net irc.freenode.net]
aij has quit [hubbard.freenode.net irc.freenode.net]
tab has quit [hubbard.freenode.net irc.freenode.net]
wysek has quit [hubbard.freenode.net irc.freenode.net]
bzzbzz has quit [hubbard.freenode.net irc.freenode.net]
tarbo2 has quit [hubbard.freenode.net irc.freenode.net]
duper` has quit [hubbard.freenode.net irc.freenode.net]
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
prigaux has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
acatout has quit [hubbard.freenode.net irc.freenode.net]
lanaer has quit [hubbard.freenode.net irc.freenode.net]
rbancroft has quit [hubbard.freenode.net irc.freenode.net]
maskd has quit [hubbard.freenode.net irc.freenode.net]
willb1 has quit [hubbard.freenode.net irc.freenode.net]
boscop has quit [hubbard.freenode.net irc.freenode.net]
__marius__ has quit [hubbard.freenode.net irc.freenode.net]
flux has quit [hubbard.freenode.net irc.freenode.net]
break has quit [hubbard.freenode.net irc.freenode.net]
Hadaka has quit [hubbard.freenode.net irc.freenode.net]
bernardofpc has quit [hubbard.freenode.net irc.freenode.net]
tsuyoshi has quit [hubbard.freenode.net irc.freenode.net]
patronus has quit [hubbard.freenode.net irc.freenode.net]
Yoric[DT] has quit [hubbard.freenode.net irc.freenode.net]
schme has quit [hubbard.freenode.net irc.freenode.net]
mbishop has quit [hubbard.freenode.net irc.freenode.net]
Demitar has quit [hubbard.freenode.net irc.freenode.net]
mattam has quit [hubbard.freenode.net irc.freenode.net]
LeCamarade|Away has quit [hubbard.freenode.net irc.freenode.net]
thelema has quit [hubbard.freenode.net irc.freenode.net]
hcarty has quit [hubbard.freenode.net irc.freenode.net]
gim has quit [hubbard.freenode.net irc.freenode.net]
mehdid has quit [hubbard.freenode.net irc.freenode.net]
delroth has quit [hubbard.freenode.net irc.freenode.net]
bartiosze has quit [hubbard.freenode.net irc.freenode.net]
mellum has quit [hubbard.freenode.net irc.freenode.net]
jlouis has quit [hubbard.freenode.net irc.freenode.net]
Ppjet6 has quit [hubbard.freenode.net irc.freenode.net]
nimred has quit [hubbard.freenode.net irc.freenode.net]
yziquel has quit [hubbard.freenode.net irc.freenode.net]
sgnb has quit [hubbard.freenode.net irc.freenode.net]
ski__ has quit [hubbard.freenode.net irc.freenode.net]
hto has quit [hubbard.freenode.net irc.freenode.net]
Maddas has quit [hubbard.freenode.net irc.freenode.net]
sgwizdak has quit [hubbard.freenode.net irc.freenode.net]
komar_ has quit [hubbard.freenode.net irc.freenode.net]
jknick has quit [hubbard.freenode.net irc.freenode.net]
r0bby has quit [hubbard.freenode.net irc.freenode.net]
bohanlon has quit [hubbard.freenode.net irc.freenode.net]
xevz has quit [hubbard.freenode.net irc.freenode.net]
mpwd has quit [hubbard.freenode.net irc.freenode.net]
aym has quit [hubbard.freenode.net irc.freenode.net]
Lomono_ has quit [hubbard.freenode.net irc.freenode.net]
jonafan has quit [hubbard.freenode.net irc.freenode.net]
maxote has quit [hubbard.freenode.net irc.freenode.net]
rwmjones has quit [hubbard.freenode.net irc.freenode.net]
gildor has quit [hubbard.freenode.net irc.freenode.net]
jeff_s_1 has joined #ocaml
Amorphous has joined #ocaml
komar_ has joined #ocaml
Yoric[DT] has joined #ocaml
yziquel has joined #ocaml
boscop has joined #ocaml
BiDOrD has joined #ocaml
Jedai has joined #ocaml
mpwd has joined #ocaml
aym has joined #ocaml
Lomono_ has joined #ocaml
jeanbon has joined #ocaml
schme has joined #ocaml
Camarade_Tux has joined #ocaml
willb1 has joined #ocaml
Snark has joined #ocaml
mbishop has joined #ocaml
pizza_ has joined #ocaml
sgnb has joined #ocaml
bzzbzz has joined #ocaml
gl has joined #ocaml
authentic has joined #ocaml
aij has joined #ocaml
jlouis has joined #ocaml
jknick has joined #ocaml
__marius__ has joined #ocaml
Ppjet6 has joined #ocaml
jonafan has joined #ocaml
tab has joined #ocaml
acatout has joined #ocaml
Maddas has joined #ocaml
tarbo2 has joined #ocaml
LeCamarade|Away has joined #ocaml
rjones__ has joined #ocaml
mellum has joined #ocaml
bartiosze has joined #ocaml
thelema has joined #ocaml
maxote has joined #ocaml
r0bby has joined #ocaml
det has joined #ocaml
hcarty has joined #ocaml
duper` has joined #ocaml
ertai has joined #ocaml
poucet has joined #ocaml
bacam has joined #ocaml
lanaer has joined #ocaml
Asmadeus has joined #ocaml
tomaw has joined #ocaml
delroth has joined #ocaml
ski__ has joined #ocaml
rwmjones has joined #ocaml
xevz has joined #ocaml
gim has joined #ocaml
break has joined #ocaml
mehdid has joined #ocaml
flux has joined #ocaml
noj has joined #ocaml
wysek has joined #ocaml
Hadaka has joined #ocaml
holgr has joined #ocaml
nimred has joined #ocaml
Ori_B has joined #ocaml
TaXules has joined #ocaml
prigaux has joined #ocaml
Demitar has joined #ocaml
rbancroft has joined #ocaml
mattam has joined #ocaml
ozzloy has joined #ocaml
mal`` has joined #ocaml
maskd has joined #ocaml
tsuyoshi has joined #ocaml
bernardofpc has joined #ocaml
patronus has joined #ocaml
hto has joined #ocaml
mrvn has joined #ocaml
brendan has joined #ocaml
gildor has joined #ocaml
sgwizdak has joined #ocaml
bohanlon has joined #ocaml
bla has joined #ocaml
<yziquel> is there any example of swig code binding C++ classes to OCaml?
aym has quit []
julm has joined #ocaml
Ched has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
sporkmonger has joined #ocaml
jmou has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
komar_ has quit [Read error: 60 (Operation timed out)]
BiDOrD has quit []
quentin_ has joined #ocaml
komar_ has joined #ocaml
jeanbon has quit ["EOF"]
<quentin_> hello
Associat0r has joined #ocaml
quentin has joined #ocaml
<quentin_> do you know how I can use ocamlsdl with ocamlbuild ?
<quentin_> actually, I type ocamlc -I /usr/lib/ocaml/site-lib/sdl bigarray.cma sdl.cma map.ml -o output
<quentin_> to compile.
<quentin_> sorry, internet problems.
quentin_ has quit ["Changing server"]
<Camarade_Tux> if you have ocamlsdl installed with findlib/ocamlfind (I'm not sure it's the default),
<Camarade_Tux> (for when he comes back and /me away)
quentin has quit ["Lost terminal"]
<yziquel> ok. seems camlidl is a better choice to bind objects... any sample code to bind C++ classes and objetcs with camlidl?
<flux> in the end just doing it manually may turn out to be the most flexible approach
<flux> unfortunately, it also requires the most work..
<flux> I think a binding-generator library would be a great thing instead of all these separate binding generator programs with their own domain-specific languages to describe the interfaces
<flux> because all libs seem to be slightly different, and in ways not often foreseen by the binding generator authors..
<Yoric[DT]> Has anyone attempted to produce .cmxs with ocamlbuild?
<yziquel> flux: I agree with you. But I'd really like to see a camlidl or swig binding of C++ objects for now. In the end, I'll probably end up doing manually, i know that.
<Yoric[DT]> Mmmmhhh...
<yziquel> flux: or perhaps it's just my lack of knowledge of C++ objects...
<flux> yziquel, well, one way to bind it would be to provide a function that returns a pointer to the create object in an ocaml-allocated object
<flux> yziquel, and then, for each method, provide a val class_method : this -> arg1 -> arg2 -> result
<flux> yziquel, obviosuly this can be wrapped into a object based interface as well
<flux> except in C++ you are expected to call a destructor..
<flux> if the object is a memory-bound object (not in possession of IO for example) that can be handled with the finalizers
<flux> otherwise, you must provide a destruction method
<flux> which should preferably invalidate the object also (ie. make the pointer in the ocaml-allocated block null and check for nulliness in all the methods)
mpwd has quit [Read error: 110 (Connection timed out)]
<yziquel> flux: I'm rather frustrated about this crappy swig documentation..
<yziquel> flux: it's frustrating because i'm pretty sure it's doing what i want to do...
<Yoric[DT]> Has anyone used .cmxs at all?
<Yoric[DT]> Has anyone around here used .cmxs at all, that is?
<jeff_s_1> sure, a bit
<yziquel> packaged one.
<Yoric[DT]> How did you compile it?
<Yoric[DT]> I have a .cmxa, which I compile to a .cmxs, I then load it but nothing happens.
<Yoric[DT]> (it should display "Hello world")
<jeff_s_1> oh, i've never done that. I've only just compiled cmx from source
<Yoric[DT]> I do mean "cmxs", i.e. dynamically linked modules.
jmou is now known as julm
<jeff_s_1> oh, not cmx + plural? I wondered. Heh, I haven't even heard of .cmxs till now.
<yziquel> ocamlfind ocamlopt $(OCAMLOPTPACKAGES) -shared -linkall -o $@ $<
<Yoric[DT]> What's in $< ?
<Yoric[DT]> Source code?
<Yoric[DT]> .cma?
<Yoric[DT]> .cmxa?
<yziquel> pgocaml.cmxa
<yziquel> that helps?
<Yoric[DT]> Well, that's what I did :(
<Yoric[DT]> Mmmmhhh....
<julm> Yoric[DT]: on what system are you?
<Yoric[DT]> When I do it from a .cmx, it works.
<Yoric[DT]> When I do it from a .cmxa, it fails.
* Yoric[DT] wonders if the .cmxa is generated correctly.
<Yoric[DT]> julm: Linux
<Yoric[DT]> 32-bits
<julm> ok
<yziquel> Yoric[DT]: trying to trim batteries down?
<Yoric[DT]> Yup.
<Yoric[DT]> Mmmmhh...
<julm> Yoric[DT]: couldn't you use directly the .a instead of the .cmxa ?
<Yoric[DT]> I could try that.
<Yoric[DT]> For the moment, a simple "cat" weights 7.3Mb in bytecode, 3.6Mb in native -- 131kb in dynamically-linked bytecode, 360kb in dynamically-linked native.
<Yoric[DT]> It's still quite big but I'm not sure we could do much better.
<Yoric[DT]> Note: using only the .a fails.
<julm> Yoric[DT]: what is the failure when you use a .cmxs built from a .cmxa?
<Yoric[DT]> My Hello world doesn't say "hello".
<Yoric[DT]> i.e. the code of the module is not executed
<Yoric[DT]> Now, the most likely reason is that I probably generate the .cmxa incorrectly in the first place.
<thelema> cmxa -> cmxs seems pretty straightforward
<thelema> Yoric[DT]: can you throw your code into batteries/tests/ somewhere so I can try it?
<Yoric[DT]> Just pushed onto the git.
<Yoric[DT]> It's a new target "foo.dynnative"
<Yoric[DT]> (for our myocamlbuild.ml))
<Yoric[DT]> Yeah, I should probably generate a .mllib or something such.
_Pb has joined #ocaml
jeanbon has joined #ocaml
Associat0r has quit [Read error: 104 (Connection reset by peer)]
<yziquel> so, anybody knows how to wrap C++ objects with camlidl?
<Yoric[DT]> thelema: there's now an experimental version which handles threads
* thelema checks it out
<Camarade_Tux> btw, when compiling batteries with godi, I get 'configure: error: Batteries is already installed' (compiled fine on yesterday)
<Camarade_Tux> should it really check during configure if batteries is already installed ?
Associat0r has joined #ocaml
<Yoric[DT]> Camarade_Tux: it's an error?
<Yoric[DT]> Oh, yeah.
<Yoric[DT]> That's because of findlib oddities.
<Yoric[DT]> We should make this smoother.
<thelema> Yoric[DT]: no myocamlbuild.ml in examples/tools?
<Yoric[DT]> Could you file a bug?
<Yoric[DT]> thelema: it's the one from batteries/doc .
<Yoric[DT]> Still, time to go.
<Yoric[DT]> It's the music festival.
<Yoric[DT]> Cheers.
Yoric[DT] has quit ["Ex-Chat"]
jeddhaberstro has joined #ocaml
willb2 has joined #ocaml
willb1 has quit [Read error: 60 (Operation timed out)]
<jeanbon> close
jeanbon has quit ["EOF"]
itewsh has joined #ocaml
schme has quit ["leaving"]
rAphael_ has joined #ocaml
<flux> yziquel, well, how did your c++ bindings go?-)
komar_ has quit [Read error: 60 (Operation timed out)]
<yziquel> flux: horrible.
<yziquel> flux: the piint is that it's a quite big C++ library.
<yziquel> flux: the point...
<yziquel> flux: and they already have a swig interface file.
willb2 has quit [Read error: 60 (Operation timed out)]
<yziquel> flux: so I'm trying to capitalise on that.
<yziquel> flux: seems like the persons who made the ocaml plugin never heard of static typing...
itewsh has quit [Read error: 110 (Connection timed out)]
<yziquel> flux: and there's no ocaml objects in the generated file...
<thelema> c_obj for everything!
itewsh has joined #ocaml
<yziquel> flux: I guess that it's not that easy to make an ocaml plugin for swig, but come on!
<thelema> and there's distinct Swig.c_obj *and* c_obj
<yziquel> flux: i guess more work could be done from the ocaml community on enhancing the swig plugin, partly because there might be quite a few python or perl C++ modules binded this way...
<yziquel> flux: but this is just horrible as it stands.
<yziquel> flux: going to have to rewrite the interface with loads of Obj.magic...
<yziquel> flux: but overall, i must agree that swig is a nice tool.
<yziquel> flux: the swig ocaml plugin dates back to 2002, by the way
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
<flux> yziquel, perhaps someone had an itch that needed scratching.. surprising that it still works these days, I guess :)
<yziquel> flux: i would bet my hand on the fact that it still works...
<yziquel> flux: it generates .ml and .mli and .cxx files, but they need to be compiled with the Swig module. I'm not sure it will work out fine...
<yziquel> flux: I wouldn't bet my hand.
<yziquel> flux: I'm sure he had an itch that needed scratching: he also created a camlp4 extension to call C functions from OCaml in a syntax close to C...
<yziquel> flux: (well, I'm not sure exactly what this syntax extension is for, exactly...)
<yziquel> thelema: watch out the "This also allows SWIG to acquire new conversions painlessly, as well as giving the user more freedom with respect to custom typing."
_Pb has left #ocaml []
<yziquel> I'll stop being nasty... he still did the job of writing this glue code.
Snark has quit ["Ex-Chat"]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<Camarade_Tux> iirc, the use of Obj was a big complain against swig
<Camarade_Tux> woah, I was wondering what you were trying to bind and I searched for "libmorfo" on google, the first result is : "paste.lisp.org/display/82243 - 9 minutes ago"
<Camarade_Tux> scary
<yziquel> Camarade_Tux: scary? why?
<Camarade_Tux> that google indexes what you write within nine minutes
<Camarade_Tux> it looks like you can't do anything without google knowing
<yziquel> Camarade_Tux: indeed. very scary...
<flux> you. could. be. indexed. RIGHT NOW!
<julm> thanks to clog
<flux> who knows thanks to what, maybe google has their own bot on each freenode channel ;-)
<Camarade_Tux> I'm already doomed : http://noobfarm.org/ ( ##slackware quotes)
rAphael_ has quit ["I'm not a bot from Google"]
<yziquel> Camarade_Tux: by the way, it's a natural language processing library.
Alpounet has joined #ocaml
<yziquel> Camarade_Tux: try "Dependency parsing" and "English", and you'll get an idea of what I'm trying to bind.
<Camarade_Tux> yziquel, looks nice, and indeed, objects everywhere ;p
<yziquel> Any comments on why this might fail?
<flux> well, you don't have dllfreelib_stubs.so is the immediate problem
<flux> (you do have dllfreeling_stubs.so, though)
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<flux> (just confirming that you know that the almost-but-not-quite-the-same names are infact different)
<flux> but I suppose that's not the issue
<flux> no, actually it looks like you took the name dllfreelib_stubs out of thin air..
<yziquel> Arg!!!
<julm> out of thin air :D
<yziquel> Reason: ./dllfreeling_stubs.so: ./dllfreeling_stubs.so: undefined symbol: pcre_free.
<yziquel> that's better!
slash_ has joined #ocaml
<Camarade_Tux> flux, a general note about a "general framework" for binding C, the problem is there is not enough information usually
<Camarade_Tux> for gobject-introspection which is the basis of ocaml-gir, extra infos have been added to the source during the last two years
<Camarade_Tux> libffi could be a solution however (never tried it but from what I read, it might be good for that)
<flux> camarade_tux, that is exactly my point, there is not enough information generally
<flux> camarade_tux, but for example for glib there is some information, for qt there is some information, etc
<flux> it's all library-specific knowledge that needs to be provided somehow
<flux> so for each binding you would basically write a program that does the binding generation
<flux> but you would have a useful set of library functions to help you do it
<palomer> there's a version of sml that has an interesting ffi
<flux> such as a lib for parsing C-code (with comments), lib for generating both ocaml and c code, etc
<flux> and possibly such a library could be accompanied with a growing set of libraries suitable for generating bindings for different kind of applications, once some commonalities are found
<Camarade_Tux> flux, hmmmmmmm, in the recent days I started to think ocaml-gir could be a good example/reference (as in a how-to) for how to bind C but it's true I could make it really modular
<Camarade_Tux> like Function(?parent_class,name,prototype...) and work on that (* weird syntax but there's the idea *)
<Camarade_Tux> I think it'll only be the third last rewrite of ocaml-gir ;p
boscop has quit ["See you later, alligator!"]
<Camarade_Tux> (that'd make everything slower but considering ocaml-gir runs in less than one second for a library that uses 150 functions and 1500 variables, it shouldn't be a problem)
<Camarade_Tux> gotta go now, see you :)
Camarade_Tux has quit ["Leaving"]
<palomer> hrmph... anyone heard of the sml ffi which was embedded into the language itself?
<yziquel> flux: how do i get the pcre symbols inside?
<yziquel> flux: i should link the dllfreeling_stubs.so with libpcre?
* palomer thinks twelf would be much more successful if it was done in ocaml
pizza_ has left #ocaml []
<flux> yziquel, well, it looks to me pcre must be linked in at some point..
<yziquel> flux: yes, but i do not really understand at which point...
<flux> yziquel, maybe you could do it with ocamlfind ocamlmktop -custom -package pcre freeling.cma or something
<flux> yziquel, how about at the point where you link in the other libs?
<yziquel> flux: the last line seems a good idea...
bzzbzz has quit [Read error: 110 (Connection timed out)]
<yziquel> flux: for ocamlmktop, you're think of pulling in the ocaml pcre package?
<flux> yziquel, yes
<flux> I think you can actually link in the lib at any point, but I don't remember for sure
<flux> in any case, I'm going off to sleep
<yziquel> flux: good night..
<flux> yziquel, energetic hacking :)
<flux> I take it it's not far from night there either?
<flux> you're only one hour earlier than here
<yziquel> flux: it's mostly a way to avoid having to work for tomorrow's exam...
<flux> yziquel, well, it seems to be working great :)
<flux> (but I suppose it'd be more gratifying to get something working..)
<yziquel> flux: it's always better than to deal with http://yziquel.homelinux.org/docs/nonsense.png
<yziquel> flux: easily implemented recursion with Maple... Beats the hell out of me.
Yoric[DT] has joined #ocaml
komar_ has joined #ocaml
Alpounet has quit [Remote closed the connection]
lde has joined #ocaml
ofaurax has joined #ocaml
ofaurax has quit [Read error: 104 (Connection reset by peer)]
<yziquel> $(OCAMLC) -a -dllib dlldbus_stubs.so -cclib -ldbus_stubs -cclib -ldbus-1 -o $@ -custom dBus.cmo
<yziquel> how does it know where to find libdbus-1?
Camarade_Tux has joined #ocaml
<Yoric[DT]> There's a default directory search list.
* Yoric[DT] doesn't know what's inside, though.
<Yoric[DT]> Well, well, well, dynamic linking does seem to work.
Associat0r has quit []
<Camarade_Tux> =)
<Camarade_Tux> btw, my problem with batteries being already installed has been solved by uninstalling it from outside godi
<Yoric[DT]> Good.
<Yoric[DT]> Still, there may be something weird going on.
slash_ has quit [Client Quit]
ehird has joined #ocaml
<ehird> godi-bin-prot works on 3.10/OS X without doing anything now
<ehird> sweet
<ehird> HUR HUR I speak before waiting.
<ehird> "### Error: Command fails with code 1: godi_console"
<ehird> > The implementation src/core/extlib/extLexing.ml
<ehird> > does not match the interface src/core/extlib/extLexing.cmi:
<ehird> Well that's just ridiculous.
<ehird> "> The field `new_line' is required but not provided"
<ehird> Is this known?
ikaros has quit ["Leave the magic to Houdini"]
<julm> yziquel> it's the linker's job (ld) there are many ways to give search directories to ld : the -rpath (for ld), the /etc/ld.so.conf.d file (for ldconfig), the LD_RPATH environment variable
<ehird> oh
<ehird> "Officially, it’s also available for OCaml 3.10, but we have just found a bug which prevents from compiling the 3.10 version"
<ehird> Hey. Ocaml thinks I can't have labltk. I wonder why.
<Camarade_Tux> ehird, which version of labltk do you have installed ?
<ehird> Camarade_Tux: I don't; GODI is compiling 3.11.
<ehird> I guess it's because it knows not the ways of freaky OS X framework Tk.
<ehird> (It just says that labltk ain't supported, so it isn't going to compile it.)
<julm> yziquel: note that after your having installed a new dynamically linked library you would probably just have to run ldconfig (to update its database) to be able to use your library.
<Camarade_Tux> ehird, sorry, not labltk, tk
<ehird> ah
<Camarade_Tux> chances are you have 7.4 or 7.5 and chances labltk needs 7.5 or 7.4
<ehird> Camarade_Tux: dunno; whatever came with OS X... 8.4 or something?
<ehird> But yeah, it's uh, in the weird framework structure.
<ehird> Not a regular library thingy. I got it working ages ago.
<ehird> Needed to patch the ocaml build system.
<Camarade_Tux> yeah, 8.x and not 7.x
* Camarade_Tux should go to bed
<ehird> Camarade_Tux: Right, I have 8.4
<ehird> Meh
<ehird> I don't really need tk
<yziquel> julm: and linking happens when? ar rcs libfreeling_stubs.a freeling_wrap.cxx.o or ocamlmklib -o freeling_stubs freeling_wrap.cxx.o or ocamlc -o blah.cma -custom ?
<yziquel> julm: I guess it's ocamlc -custom... So i'd need to tweak LD_RPATH, i guess...
<Camarade_Tux> ar rcs merely grabs all the .o files and puts them in a single (stripped) file with an index
<julm> yziquel: ld is called when you build your executable
<julm> LD_RPATH is only use when you run your executable
<yziquel> julm: so ocaml -custom...?
<yziquel> ocamlc
<julm> -custom is used to build a .cma not an executable IIRC
<yziquel> grr...
<Camarade_Tux> it's still called 'custom linking' iirc
<yziquel> LDFLAGS = -cclib -Lsomewhere?
<Camarade_Tux> yziquel, you might try OCamlMakefile, it works great for that
<julm> yziquel: normally you should just put your .so in `ocamlc -where`/stublibs and run ldconfig
<julm> that is more portable than using -rpath or something else
johnnowak has joined #ocaml
<Camarade_Tux> http://ocaml.pastebin.com/m2b922bfb <- that's what I use to bind gio (it has three files, the .c provide the functions, the gtkgio.ml has only "external" entries and the ggio.ml provides a nice interface)
<julm> and in fact you just pass your .so to [ocamlfind install] and ocamlfind puts it in stublibs
<julm> also note that your .so must have a "dll" prefix
<yziquel> Camarade_Tux: I'm a bit wary of OCamlMakefile...
<Camarade_Tux> why ?
<Camarade_Tux> as far as I'm concerned, I don't trust it that much, but I trust it more than I trust myself
<Camarade_Tux> (in that case of annoying linking)
<Camarade_Tux> I've had a lot of troubles getting the right switches, order and everything, I got it once, and lost it, ocamlmakefile just seems safer here
<Camarade_Tux> (I wanted to use ocamlbuild but that wasn't exactly easy)
<yziquel> Camarade_Tux: because Markus Mottl's postgresql binding's OCamlMakefile scares me so much.
<Yoric[DT]> ehird: since 3.11 is out, we haven't been working very hard on getting Batteries to work with 3.10...
<ehird> yah
<ehird> i redid it with 3.11
<ehird> since I had no idea it was out
<ehird> as the godi site doesn't mention it :)
<julm> Camarade_Tux> it's still called 'custom linking' iirc <- FWICS -custom is only used for static linking
<Yoric[DT]> Well, anyway, time to call this a night.
<Yoric[DT]> Cheers everyone.
Yoric[DT] has quit ["Ex-Chat"]
<Camarade_Tux> julm, I have to say I'm really sleepy right now but I thought -custom was used for bytecode and dynamic linking =/
<ehird> *SIGH*
<Camarade_Tux> gotta sleep now, night everyone
<ehird> godi-batteries depends on GNU cp.
<ehird> I'm not even joking.
<julm> pleasant dreams Camarade_Tux
<julm> \o_
<ehird> *Why* would you depend on GNU cp? That's just ridiculous.
<julm> maybe they use [cp] to install files instead of [install] ?
<ehird> 00:05 julm: maybe they use [cp] to install files instead of [install] ?
<ehird> yeah
<ehird> and since bsd cp doesn't have -a, booM!
<ehird> everything breaks
<ehird> *boom
<ehird> does everyone using ocaml use gnulinux :\?
<julm> I do
<julm> ehird: I can see in the manual of cp that -a = -dpR, does your cp have -d -p and -R ?
<yziquel> julm: shouldn't ocamlc -a -dllib dllfreeling_stubs.so -cclib -lfreeling_stubs -cclib -lpcre -o freeling.cma -custom freeling.cmo swig.cmo
<yziquel> be ok?
<ehird> julm: I have all of those apart from -d
<ehird> usage: cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file target_file
<ehird> cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file ... target_directory
<julm> ehird: -d identique à --no-dereference --preserve=links
<ehird> julm: I highly suspect install(1) should be used instead.
<julm> ehird: absolutely
<ehird> installing then removing coreutils just for this is so silly..
<ehird> *...
<yziquel> julm: i mean, libpcre.a is in /usr/lib... That shouldn't be a problem for ld...
<julm> yziquel: does it fail ?
<yziquel> julm: not when typing this command on the command line...
<yziquel> julm: but when loading the .cma...
<julm> what is the error then ?
<yziquel> Cannot load required shared library dllfreeling_stubs.
<yziquel> Reason: ./dllfreeling_stubs.so: ./dllfreeling_stubs.so: undefined symbol: pcre_free.
<julm> yziquel: it's -dllib -l<name>
<yziquel> ?? in ocaml-dbus, they have $(OCAMLC) -a -dllib dlldbus_stubs.so -cclib -ldbus_stubs -cclib -ldbus-1 -o $@ -custom dBus.cmo
<julm> in the manual it's -dllib -l<name>
<julm> it's more portable
<julm> and could you add a -dllib -lpcre ?
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
<ehird> ### Installation completed
<yziquel> julm: ocamlc -a -dllib -lfreeling_stubs -dllib -lpcre -o freeling.cma -custom freeling.cmo swig.cmo
<ehird> Now to uninstall coreutils. Until next time!
<julm> yziquel: yep
<julm> yziquel: how does it fail now ?
<ehird> grr, typing 'ocamlfind batteries/' is a pain; maybe I'll alias b* to them
<yziquel> juml: Cannot load required shared library dllpcre.
<julm> yziquel: put the -dllib at the end
<yziquel> julm: Reason: dllpcre.so: dllpcre.so: cannot open shared object file: No such file or directory.
<julm> yziquel: check if dllpcre.so is in `ocamlc -where`/stublibs
<yziquel> ocamlc -a -o freeling.cma -custom freeling.cmo swig.cmo -dllib -lfreeling_stubs -dllib -lpcre
<yziquel> julm: no.
Associat0r has joined #ocaml
<julm> yziquel: have you installed the pcre binding for ocaml ?
<yziquel> dllpcre_stubs.so
<ehird> > ===> Configuring for godi-camlp5-5.11
<ehird> > Sorry: the compatibility with ocaml version "3.11.1"
<ehird> > is not yet implemented. Please report.
<ehird> Uhh, you can't use camlp5 with 3.11?
<julm> yziquel: are all the .so in stublibs named like that ? with a _stubs ?
<ehird> Oh, maybe you need 5.12. But ledit depends on 5.11.
<yziquel> julm: but the thing is... it's the c++ code I'm binding that relies on pcre... nothing else. So I do not really see why it should link to the libpcre_stubs.so in /stublibs.
<julm> try -dllib -lpcre_stubs then
<yziquel> julm: no, but quite a lot are.
<julm> ah
<yziquel> julm: Cannot load required shared library dllfreeling_stubs.
<yziquel> Reason: ./dllfreeling_stubs.so: ./dllfreeling_stubs.so: undefined symbol: _ZNSs4_Rep20_S_empty_rep_storageE.
<julm> outch
<hcarty> ehird: OCaml versions are specifically whitelisted for camlp5. So until camlp5 is updated for 3.11.1, it will give that error.
<yziquel> julm: this symbol is generated by swig.
<hcarty> ehird: It works fine with 3.11.0
<ehird> ugh.
<ehird> GODI needs --section actually-work-with-things
<yziquel> julm: that may not be that bad. it may mean that pcre symbols are ok, and that the swig ones are not.
<hcarty> ehird: OR, you could check the mailing list and camlp5 web sites :-) They each have information on this.
<julm> but, you said you didn't use the ocaml-pcre stuff :/
<hcarty> ehird: GODI 3.11.x is not officially released yet anyway
<julm> where is the libpcre.so your C++ code should use ?
<ehird> hcarty: But Batteries won't compile with 3.10!!
* palomer hopes that people will skip 3.11.0 altogether
<yziquel> julm: pcre is used by the C++ code. Not by OCaml code, so not using the OCaml pcre bindings.
<ehird> This is like the 3rd time I've tried to get ocaml working...
<hcarty> ehird: Batteries doesn't need camlp5 either
<ehird> hcarty: Yes, but other things do.
<yziquel> julm: that's one good question.
<ehird> I can either have Batteries or camlp5...
<hcarty> ehird: True. It all works with 3.11.0.
<hcarty> You could contact the camlp5 author
<julm> yziquel: something like /usr/lib/libpcre.so
<ehird> hcarty: Bleh... --section 3.11 uses .1. I read nowhere that I had to use 3.11.0... guess I'll reinstall. Tomorrow.
<yziquel> julm: yes, that's what i was aiming at using.
<hcarty> ehird: I'm not sure if you can directly
<hcarty> GODI is not managed as a whole - each package is managed independently
<hcarty> They can get out of sync on occasion. If you report this sort of problem to the GODI mailing list it is generally fixed rather quickly.
<julm> yziquel: why do you use -custom if you're doing dynamic linking ?
<yziquel> julm: because I copy pasted it from libdbus :/
<yziquel> julm: static linking would be perfect for now...
<julm> yziquel: ocamlc -a -o freeling.cma freeling.cmo swig.cmo -dllib -lfreeling_stubs -ccopt -L/usr/lib -cclib -lpcre
<julm> gives what ?
komar_ has quit [Read error: 60 (Operation timed out)]
<yziquel> Reason: ./dllfreeling_stubs.so: ./dllfreeling_stubs.so: undefined symbol: pcre_free.
<julm> yziquel: if you add -custom, then -cclib -l<name> looks at lib<name>.a not lib<name>.so
<julm> ah
<julm> put -dllib -lfreeling_stubs after -ccopt -L/usr/lib -cclib -lpcre
<yziquel> julm: same message.
<yziquel> julm: let's drop it for tonight...
<julm> yziquel: could you give me your code so I can test ?
<yziquel> julm: will give you, but I'm exhausted tonight... will give you tomorrow.
<julm> ok
<julm> good night then \o_
lde has quit [Remote closed the connection]