| Newsgroups |
gmane.comp.lang.ocaml.beginners |
| Message-ID |
<[email protected]> |
On Mon, Jul 13, 2015 at 09:49:48PM +0200, Christophe Troestler wrote:
> Hi,
>
> Here is a example of using Cairo with gtk
> https://github.com/Chris00/ocaml-cairo/blob/master/examples/gtk_demo.ml
> that comes with oasis compiling directives:
> https://github.com/Chris00/ocaml-cairo/blob/master/_oasis
>
> Note that this is another binding to Cairo, known as cairo2 in OPAM.
>
> Hope it helps,
> Best,
> C.
Yes, it did help. Thank you. But insteaad of trying to figure out
oasis (another huge lump to swallow before I get anything going, aind
I'm really not sure if I need to understand this until I have a bigger
project, or am preparing a package for distribution) I just used
ocamlfind ocamlopt -o foom -package cairo2,lablgtk2,cairo2.lablgtk2 -linkpkg foo.ml
and then
./foom
gave me a window with some coloured circles. Do I understand correctly
that there's no user interaction in this program?
-- hendrik
>
> On Mon, 13 Jul 2015 10:35:28 -0400, Hendrik Boom [email protected] [ocaml_beginners] wrote:
> >
> > I finally found where ml_gdk_cairo_create is defined. Its definition
> > was cunningly hidden from Google search by token-pasting.
> >
> > Within cairo.1.2.0/src/ml_cairo_lablgtk.c, in the source code I obtained
> > from opam source, there is the line
> >
> > wML_1(gdk_cairo_create, GdkDrawable_val, Val_cairo_t)
> >
> > wML_1 is defined in cairo.1.2.0/src/ml_cairo_wrappers.h, and
> > token-pastes "ml_" onto the start of "gdk_cairo_create"
> > to produce ml_gdk_cairo_create
> >
> > What remains to be explained is why the compiled code doesn't seem to
> > end up in opam's cairo library.
> >
> > Any ideas?
> >
> > -- hendrik
> >
> > On Sat, Jul 11, 2015 at 10:48:37PM -0400, Hendrik Boom [email protected]
> > [ocaml_beginners] wrote:
> > > On Sun, Jul 12, 2015 at 08:07:04AM +0900, Gabriel Scherer
> > [email protected] [ocaml_beginners] wrote:
> > > > When building an executable you should pass the flag -linkpkg to ocamlfind.
> > >
> > > Yes, that helps a lot. Thanks. I'm left with one undefined symbol:
> > >
> > > hendrik@notlookedfor:~/dv/fun/group/toy/cairo_toy$ ocamlfind ocamlopt
> > -package cairo -package lablgtk2 -linkpkg toy_maker.mli toy_maker.ml
> > my_interactor.ml demo_toy.ml -o runme
> > > toy_maker.o: In function `camlToy_maker__redraw_1030':
> > > (.text+0x102): undefined reference to `ml_gdk_cairo_create'
> > > collect2: error: ld returned 1 exit status
> > > File "caml_startup", line 1:
> > > Error: Error during linking
> > > hendrik@notlookedfor:~/dv/fun/group/toy/cairo_toy$
> > >
> > >
> > > Now presumably this is the symbol referenced in cairo_lablgtk.ml:
> > >
> > > external create : [> `drawable] Gobject.obj -> Cairo.t =
> > "ml_gdk_cairo_create"
> > >
> > > and I'd guess there should be C code around somewhere interfacing this module
> > to
> > > the actual gdk or cairo libraries. And a shared or unshared binary library
> > > somewhere defining it. But a google search didn't find it, and
> > > presumably there's some proper way to track it down.
> > >
> > > -- hendrik
> > >
> > > >
> > > > On Sun, Jul 12, 2015 at 7:54 AM, Hendrik Boom [email protected]
> > > > [ocaml_beginners] <[email protected]> wrote:
> > > >
> > > > > On Sat, Jul 04, 2015 at 10:29:22AM -0400, Hendrik Boom
> > > > > [email protected] [ocaml_beginners] wrote:
> > > > > > On Sat, Jul 04, 2015 at 06:19:02AM +0000, Gage Peterson
> > > > > [email protected] [ocaml_beginners] wrote:
> > > > > > > Use opam. It will work out much better. Also I don't think you should
> > > > > ever
> > > > > > > have to run it from root.
> > > > > >
> > > > > > Running it from root was a mistake. And the way it affected the
> > > > > > results was a clue that the Debian-installed packages weren't even
> > > > > > being seen. THough first I misinterpreted the clue.
> > > > > >
> > > > > > I'll try opam. That should work.
> > > > > >
> > > > > > Will report back.
> > > > >
> > > > > OK. Did
> > > > > opam install lablgtk
> > > > > and
> > > > > opam install cairo
> > > > >
> > > > > Now I get
> > > > >
> > > > > hendrik@notlookedfor:~/dv/fun/group/toy/cairo_toy$ ocamlfind ocamlopt
> > > > > -package cairo -package lablgtk2 toy_maker.mli toy_maker.ml
> > > > > my_interactor.ml demo_toy.ml -o runme
> > > > > File "demo_toy.ml", line 1:
> > > > > Error: No implementations provided for the following modules:
> > > > > GMain referenced from toy_maker.cmx, my_interactor.cmx
> > > > > GPack referenced from toy_maker.cmx
> > > > > GWindow referenced from toy_maker.cmx
> > > > > GBin referenced from toy_maker.cmx
> > > > > Cairo referenced from my_interactor.cmx
> > > > > GMisc referenced from toy_maker.cmx
> > > > > hendrik@notlookedfor:~/dv/fun/group/toy/cairo_toy$
> > > > >
> > > > >
> > > > > Can I conclude that I'm now getting as far as the linker?
> > > > >
> > > > > How do I go abbout getting it to actually *find* these modules?
> > > > >
> > > > > -- hendrik