gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
<NaCl> you could just gather it from other sources and do a test for system architecture on startup
<NaCl> if it's x86_64, then the size is x, if x86, then y...
<NaCl> except I don't think there's a way of acquiring that outside of C either...
<virtuoussin13> well
<virtuoussin13> you can infer it from the size of a NativeInt...?
<_habnabit> Nope.
<_habnabit> That's an int, not a size_t
<_habnabit> Or a long, or something. Not a size_t, though
<virtuoussin13> I mean, you can infer what platform you're running on from that, and from there hard code what the size_t on that platform is
<_habnabit> Pretty sure you can't
<NaCl> _habnabit: NativeInt.size returns Sys.word_size
<NaCl> at least in 3.12.1
<_habnabit> Yes, and I'm pretty sure you can't guess the size of size_t from they
<_habnabit> That
<virtuoussin13> no, but you can the arch you're on from that
<virtuoussin13> right?
<NaCl> the arch of ocaml
<NaCl> I think
<NaCl> Size of one word on the machine currently executing the Caml program, in bits: 32 or 64.
<_habnabit> Yeah, ocaml and lua aren't even guaranteed to both have the same size_t sizes
<virtuoussin13> hrm.
<NaCl> http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php is a good place to start looking at the ocaml FFI
<NaCl> should you choose to use it
* NaCl isn't really able to use ocaml at work. :/
<virtuoussin13> lol, from the guide i'm using to the Lua VM:
<virtuoussin13> "Anyway, most of the time there is little need to seriously scrutinize the header, because since Lua source code is usually available, a chunk can be readily compiled into the native binary chunk format."
* virtuoussin13 punches a baby
<_habnabit> Yeah, I was confused why you weren't generating lua source
<NaCl> virtuoussin13: writing a decompiler?
<virtuoussin13> NaCl: nah, the professor wants to teach his compilers class by having the students write a compiler for a invented scripting language, and have that language target the lua vm
<virtuoussin13> it falls to me to evaluate how feasible that will be
<_habnabit> Hahahah
<_habnabit> What a terrible idea
<NaCl> haha
<NaCl> virtuoussin13: a grad student, I presume?
julm has joined #ocaml
<virtuoussin13> a motivated undergrad actually
<NaCl> ah. good for you.
<NaCl> I'd suggest the java VM
<_habnabit> I was going to say that too
<virtuoussin13> funny you say that, but he rejected the jvm as being too complex
<virtuoussin13> and I will say this, the lua vm is dead simple
<NaCl> but it's arch-dependent?
<virtuoussin13> yeah, apparently...
<NaCl> fix the arch to 32 bits
<NaCl> problem solved.
<virtuoussin13> hah, screw you students who use 64-bit machines
<NaCl> they can install 32-bit stuff
Boscop_ has joined #ocaml
<NaCl> virtuoussin13: the professor could also just provide a skeleton containing a function for grabbing the size of a size_t
<virtuoussin13> s/the professor/me/
<NaCl> Oh, right.
Boscop has quit [Ping timeout: 258 seconds]
Boscop__ has joined #ocaml
Boscop_ has quit [Ping timeout: 255 seconds]
everyonemines has joined #ocaml
eikke has quit [Ping timeout: 245 seconds]
struktured has quit [Ping timeout: 244 seconds]
<virtuoussin13> alright, looks like the only reliable thing I can do is do as you suggest
<virtuoussin13> thanks guys
<NaCl> np
Boscop__ is now known as Boscop
Boscop has quit [Changing host]
Boscop has joined #ocaml
<virtuoussin13> can you only use C functions from within ocamlopt code?
<virtuoussin13> oh, never mind
wishi has quit [Ping timeout: 260 seconds]
Modius has quit [Quit: "Object-oriented design" is an oxymoron]
<virtuoussin13> actually wait, can you only link in C functions using ocamlopt?
fogus-away has quit [Quit: fogus-away]
wishi has joined #ocaml
<virtuoussin13> okay, I got it to work. thanks guys for all your help NaCl, that site was just what I needed
<NaCl> np
Boscop has quit [Ping timeout: 258 seconds]
sebz_ has quit [Quit: Computer has gone to sleep.]
joewilliams_away is now known as joewilliams
ag4ve has joined #ocaml
Apsalar has quit [Quit: Leaving]
sebz has joined #ocaml
virtuoussin13 has quit [Remote host closed the connection]
everyonemines has quit [Quit: Leaving.]
bzzbzz has joined #ocaml
junsuijin has quit [Quit: Leaving.]
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
arubin has quit [Quit: arubin]
bobry has joined #ocaml
joewilliams is now known as joewilliams_away
dnolen has quit [Quit: dnolen]
Garen has joined #ocaml
struktured has joined #ocaml
ztfw has joined #ocaml
edwin has joined #ocaml
ikaros has joined #ocaml
hto has quit [Quit: Lost terminal]
hto has joined #ocaml
ygrek has joined #ocaml
Cyanure has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
mnabil has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
mnabil has quit [Ping timeout: 240 seconds]
mnabil has joined #ocaml
everyonemines has joined #ocaml
mnabil has quit [Ping timeout: 260 seconds]
bitbckt has quit [Quit: out]
lopex has joined #ocaml
bitbckt has joined #ocaml
Kakadu has joined #ocaml
emmanuelux has joined #ocaml
ygrek has joined #ocaml
ttamttam has joined #ocaml
lopex has quit []
ztfw has quit [Remote host closed the connection]
ztfw has joined #ocaml
Boscop has joined #ocaml
everyonemines has quit [Quit: Leaving.]
ttamttam has quit [Ping timeout: 276 seconds]
Reaganomicon has quit [Remote host closed the connection]
taupin has quit [Remote host closed the connection]
ttamttam has joined #ocaml
funktronic has joined #ocaml
eikke has joined #ocaml
ttamttam has left #ocaml []
emmanuelux has quit [Ping timeout: 244 seconds]
sebz has quit [Quit: Computer has gone to sleep.]
x711Li has joined #ocaml
x711Li has quit [Quit: Leaving]
x711Li has joined #ocaml
x711Li has quit [Client Quit]
Cyanure has quit [Ping timeout: 258 seconds]
x711Li has joined #ocaml
x711Li has quit [Client Quit]
x711Li has joined #ocaml
x711Li has quit [Client Quit]
x711Li has joined #ocaml
sebz has joined #ocaml
ttamttam has joined #ocaml
jamii has joined #ocaml
edwin has quit [Remote host closed the connection]
Cyanure has joined #ocaml
everyonemines has joined #ocaml
funktronic has quit [Quit: funktronic]
ttamttam has quit [Remote host closed the connection]
ttamttam has joined #ocaml
funktronic has joined #ocaml
funktronic has quit [Client Quit]
avsm has joined #ocaml
bitbckt has quit [Quit: out]
bitbckt has joined #ocaml
arubin has joined #ocaml
jamii has quit [Ping timeout: 258 seconds]
ttamttam has left #ocaml []
alkoma has joined #ocaml
struktured has quit [Ping timeout: 252 seconds]
joewilliams_away is now known as joewilliams
avsm has quit [Quit: Leaving.]
oriba has joined #ocaml
lopex has joined #ocaml
corecode has joined #ocaml
<corecode> hi there
<corecode> what would you suggest for a quick crash course for ocaml?
emmanuelux has joined #ocaml
<adrien> i don't know if I'll come up with something good, but: which background?
<corecode> many years of C, ruby
<corecode> i'm gonna go through the manual
<raphael-p> corecode: are you looking for a "first steps" kind of thing?
<raphael-p> or do you know the syntax and want to start building something?
<corecode> a syntax + operator crash course would be welcome
<corecode> i guess the manual is quite good
<Qrntzz> I'd recommend practical ocaml by smith j. b.
<Qrntzz> great book and suitable for starters too.
<raphael-p> cs.jhu.edu/~scott/pl/lectures/caml-intro.html
<raphael-p> ocf.berkeley.edu/%7Embh/tutorial/index.html
<corecode> did you get a lot of traffic from the acm queue article?
<raphael-p> didn't notice increase on the irc channel
<corecode> ok
Kakadu has quit [Quit: Konversation terminated!]
<raphael-p> corecode: results 2 to 5 searching for "ocaml tutorial" on ddg.gg seem all good to me
<corecode> ok
<corecode> thanks
<adrien> which acm queue article? :P
<adrien> thanks
alkoma has quit [Ping timeout: 258 seconds]
pdhborges has joined #ocaml
<corecode> so
<corecode> is there a way to use C libraries during runtime?
<corecode> or do i always have to write stub functions?
eikke has quit [Ping timeout: 248 seconds]
<adrien> that's not something very compatible with compilation
<adrien> and definitely the opposite of safety
_x711Li has joined #ocaml
x711Li has quit [Ping timeout: 258 seconds]
edwin has joined #ocaml
oriba has quit [Quit: oriba]
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
Boscop_ has joined #ocaml
Boscop has quit [Disconnected by services]
Boscop_ is now known as Boscop
Boscop has quit [Changing host]
Boscop has joined #ocaml
<corecode> adrien: fair. i guess what i ment was a way to access C functions without writing explicit wrappers in C
<adrien> which C library?
<adrien> (I don't believe in such tools; I do believe in generation from sufficiently-documented C sources however)
<corecode> let's say libpulse, because that's what I am interested in right now
<adrien> what is it?
<corecode> interface library to pulseaudio
<corecode> but that doesn't matter for my question
<adrien> how many functions are there? how many are you interested in?
edwin has quit [Remote host closed the connection]
sebz has quit []
alkoma has joined #ocaml
arubin has quit [Quit: arubin]
arubin has joined #ocaml
pdhborges has quit [Quit: Page closed]
ygrek has quit [Remote host closed the connection]
<corecode> in there are dozens
<corecode> interested maybe 5?
<corecode> but i'm interested in the general principle
<adrien> the way I see it, you have:
<adrien> 1- fully automated binders: crap API, unsafe API, and I don't believe they can be fully automatic anyway
<adrien> (they generate a crappy API)
<adrien> 2- hand-made: requires some knowledge of the libraries and the languages; otoh, if you have troubles understanding what's going on, an automatic tool like in 1- would probably fail anyway
<adrien> quite easy to get a few functions; doesn't take that much time
<adrien> 3- tool to automate the process, with a hand-made base: reuses some of the work from 2- but needs more thinking than 2-; useful for libraries with many functions
<adrien> I made a tool for 3- and I consider that the only sane way for big libraries
<adrien> however, it takes some time because you have to make something to handle many more cases
dnolen has joined #ocaml
<corecode> but it still needs a C stub?
Reaganomicon has joined #ocaml
<adrien> you need to say how you want to map a C struct to OCaml code
<adrien> no program will do that properly all the time
* adrien -> bed
avsm has joined #ocaml
x711Li has joined #ocaml
ztfw has quit [Remote host closed the connection]
_x711Li has quit [Ping timeout: 276 seconds]
Amorphous has quit [Ping timeout: 260 seconds]
Cyanure has quit [Read error: Operation timed out]
Amorphous has joined #ocaml
alkoma has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
preyalone has joined #ocaml
<preyalone> I'm getting "Line 45 Error: This function is applied to too many arguments; maybe you should use a `;'" https://gist.github.com/1256809
<preyalone> xlat' is a static key, xlat is a function that treats xlat' as an infinite cycle, returning a portion starting at index i of length len.
<preyalone> Ah. concat joins a list of lists, not two lists together. My bad, I should use append instead.
preyalone has quit [Ping timeout: 252 seconds]
lopex has quit []
avsm has quit [Quit: Leaving.]
ulfdoz has quit [Ping timeout: 252 seconds]
ulfdoz has joined #ocaml
alkoma has joined #ocaml
alkoma has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]