<exa>
hi there, i got a problem with swig. I use a C interface (to a C++ object) extern int compressed_size_bitstring(char *bitstring, int length); <--- but I can't call it with args (C_string "something") (C_int somethingelse)
<exa>
the generated interface goes like this, and it makes no sense to me: val _compressed_size_bitstring : c_obj -> c_obj
<exa>
how am I going to pass my parameters? I'm not using ocamlp4
<exa>
might the problem be because the code i am trying to interface is c++? uh
Oatmeat|umn has joined #ocaml
<exa>
I am going to paste 4 lines, I'm trying to make an ocaml interface to the famous example module with the factorial function. There is a one arg fact(.) function and a two arg my_mod(.,.) function in example.c
<exa>
# _fact (C_int 5);;
<exa>
- : Example.c_obj = C_int 120
<exa>
# _my_mod (C_int 6) (C_int 3);;
<exa>
This function is applied to too many arguments, maybe you forgot a `;'
jacobolus has quit []
love-pingoo has joined #ocaml
<smimou>
exa: I don't know swig very well, but it gave me very ugly bindings when I used it
<smimou>
you'd better try camlidl, or better, do the bindings by hand
finelemon has joined #ocaml
finelemo1 has joined #ocaml
finelemo2 has quit [Read error: 110 (Connection timed out)]
jacobolus has joined #ocaml
finelemon has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Connection reset by pear"]
_fab has joined #ocaml
fly_80 has joined #ocaml
<fly_80>
hello all
<fly_80>
where can I find information on the "types inference algorithm " used by ML ? ( possibly a free resource )
<zmdkrbou>
google and you'll find papers
<_fab>
fly_80: look on wikipedia for the milner type inference algorithm
<exa>
stupid emphasis on camlp4 and C++ objects while I need proper doc on interfacing with plain C first.
<exa>
how do I pass multiple parameters to the C function? One parameter works. Two parameters doesn't.
<exa>
_fact (C_int 5);; works _my_mod (C_int 6) (C_int 3);; the latter is a function that takes two parameters. how do I get it to work? I don't care about C++. I am just trying to understand how the C wrapper works.
<exa>
the latter doesn't work
<dylan>
wow
<exa>
:'( somebody help me please
<dylan>
whatever you are using is a lot more difficult than using ocaml's native foreign function interface
<exa>
so there is no point to using SWIG?
<dylan>
I'd say no, not for ocaml.
Itkovian has quit []
<exa>
well, here I am wrapping just one thing, but in near future I might wanna wrap the entire C++ module.
<exa>
nobody knows how this thing works?
<exa>
except the author perhaps :/
<dylan>
that will be hard in ocaml FFI, but not impossible.
<dylan>
you'll have to wrap the C++ thing in C.
<exa>
well i don't want to do that actually
<asbeta>
hmm... swig authors says there's a point :)
<exa>
but more to the point, while there is such a facility i wanna learn how to use it and the docs absolutely suck
<asbeta>
is there a good manual about ocaml ffi?
<dylan>
the ocaml manual covers it quite nicely.
<exa>
yea i know how cool FFI is, but didn't any of you use SWIG? i mean, i really got to solve this problem or I won't be able to finish my paper please somebody help me :(
<dylan>
I've used SWIG for perl. For a while.
<exa>
and I promise that I will post the resulting proggie on ocaml list
<exa>
it's pretty interesting i think
<exa>
I could easily use SWIG to wrap the same module for python
<dylan>
Swig for ocaml scares the bejesus out of me, though
<exa>
but I can't make any sense out of the ocaml wrapping!
<dylan>
ocaml is radically different than python.
<exa>
I actually understand that :)
<exa>
but this funky pattern matching in the generated .ml file, what the hell is this?