Guillaume Yziquel a écrit :
>
> So, has anyone used Swig to make an OCaml .cm[x]a library?
>
> All the best,
>
> Guillaume Yziquel.
I do not see what I am doing wrong:
> yziquel@seldon:~/svn/main/libmorfo-ocaml$ make 2>& 1 | grep -v warning | grep -v Warning
> swig -ocaml -c++ freeling.i
> cp freeling_wrap.cxx freeling_wrap.cxx.c
> ocamlc -c swig.mli
> ocamlc -c swig.ml
> File "swig.ml", line 159, characters 54-57:
> gcc -Wall -fPIC -O2 -I/usr/include -I/usr/lib/ocaml/3.11.0 -I/usr/lib -c -xc++ freeling_wrap.cxx.c
> freeling_wrap.cxx.c: In function ‘caml_value_t _wrap_new_tokenizerfreeling(caml_value_t)’:
> freeling_wrap.cxx.c: In function ‘caml_value_t _wrap_tokenizer_tokenize__SWIG_0freeling(caml_value_t)’:
> freeling_wrap.cxx.c: In function ‘caml_value_t _wrap_tokenizer_tokenize__SWIG_1freeling(caml_value_t)’:
> freeling_wrap.cxx.c: In function ‘caml_value_t _wrap_tokenizer_tokenizefreeling(caml_value_t)’:
> freeling_wrap.cxx.c: In function ‘caml_value_t _wrap_delete_tokenizerfreeling(caml_value_t)’:
> freeling_wrap.cxx.c: At global scope:
> ocamlc -c freeling.mli
> ocamlc -c freeling.ml
> File "freeling.ml", line 51, characters 13-14:
> ar rcs libfreeling_stubs.a freeling_wrap.cxx.o
> ocamlmklib -o freeling_stubs freeling_wrap.cxx.o
> ocamlc -a -dllib dllfreeling_stubs.so -cclib -lfreeling_stubs -cclib -lpcre -o freeling.cma -custom freeling.cmo swig.cmo
> yziquel@seldon:~/svn/main/libmorfo-ocaml$ ocaml freeling.cma
> Cannot load required shared library dllfreeling_stubs.
> Reason: ./dllfreeling_stubs.so: ./dllfreeling_stubs.so: undefined symbol: pcre_free.
And the files:
> yziquel@seldon:~/svn/main/libmorfo-ocaml$ ls
> freeling.i Makefile swig.ml swig.mli
> yziquel@seldon:~/svn/main/libmorfo-ocaml$ cat freeling.i
> %module freeling
> %{
> #include "freeling.h"
> #include <pcre.h>
> %}
>
> class tokenizer {
> public:
> /// Constructor
> tokenizer(const std::string &);
>
> /// tokenize string with default options
> std::list<word> tokenize(const std::string &);
> /// tokenize string with default options, tracking offset in given int param.
> std::list<word> tokenize(const std::string &, unsigned long &);
> };
> yziquel@seldon:~/svn/main/libmorfo-ocaml$ cat Makefile
> all:
> swig -ocaml -c++ freeling.i
> cp freeling_wrap.cxx freeling_wrap.cxx.c
> ocamlc -c swig.mli
> ocamlc -c swig.ml
> gcc -Wall -fPIC -O2 -I/usr/include -I/usr/lib/ocaml/3.11.0 -I/usr/lib -c -xc++ freeling_wrap.cxx.c
> ocamlc -c freeling.mli
> ocamlc -c freeling.ml
> ar rcs libfreeling_stubs.a freeling_wrap.cxx.o
> ocamlmklib -o freeling_stubs freeling_wrap.cxx.o
> ocamlc -a -dllib dllfreeling_stubs.so -cclib -lfreeling_stubs -cclib -lpcre -o freeling.cma -custom freeling.cmo swig.cmo
>
> clean:
> rm -Rf freeling.ml
> rm -Rf freeling.mli
> rm -Rf freeling_wrap.cxx
> rm -Rf freeling_wrap.cxx.c
> rm -Rf freeling.cmi
> rm -Rf freeling.cmo
> rm -Rf freeling_wrap.cxx.o
> rm -Rf swig.cmi
> rm -Rf swig.cmo
> rm -Rf freeling.cma
> rm -Rf libfreeling_stubs.a
> rm -Rf dllfreeling_stubs.so
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user