caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: micha <micha-1@fantasymail.de>
To: Erik de Castro Lopo <mle+ocaml@mega-nerd.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Wrapping C++ in Ocaml?
Date: Tue, 02 Jan 2007 14:13:03 +0100	[thread overview]
Message-ID: <459A5A5F.9030808@fantasymail.de> (raw)
In-Reply-To: <20070102213221.952a4d3f.mle+ocaml@mega-nerd.com>

Erik de Castro Lopo schrieb:
> Hi all,
>
> I have wrapped a C library for use with Ocaml and didn't find 
> the task too daunting. I have now found a C++ library that would
> be useful, but the Ocaml ORA book makes no mention of wrapping
> C++ libraries.
>
>   
you can only wrapp via C - functions

> Has anyone got any experience wrapping C++ libraries in Ocaml?
> Is it possible? Painful but doable? Too painful to think about?
>
>   
I have done it a few times, it's much typing :-)
you must write a c function for the methods of the class you want to 
wrap and give them a pointer to the c++ class, so you can call the 
method there. Often you define on the c++ side an adapter class which 
delegates method calls to the ocaml side (f.e. when wrapping events from 
and to c++/ocaml). For big libraries it's a neverending task without 
more tools.
There is the platinum framework (on sourceforge), a c++ class lib with a 
little gui. This lib compiles for win32, Linux, WinCE and qnx, I have 
done some wrapping to the gui part, together with the event handling and 
it works very nice (if you want to read it as an example).

> Any pointers or advice appreciated.
>
>   
Python, Ruby and Perl all have wrappers for QT and they use tools to 
generate the C interface I think. Maybe worth to look at...

cheers,
 Michael


  reply	other threads:[~2007-01-02 13:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02 10:32 Erik de Castro Lopo
2007-01-02 13:13 ` micha [this message]
2007-01-02 14:57 ` [Caml-list] " Dmitry Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=459A5A5F.9030808@fantasymail.de \
    --to=micha-1@fantasymail.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=mle+ocaml@mega-nerd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).