Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Kakadu <kakadu.hafanana@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] [Lablqt] Map C++ classes to OCaml
Date: Mon, 10 Oct 2011 15:30:29 +0400	[thread overview]
Message-ID: <CAGmVoG3iqRCXQOgiwqjZqdV8F8TarNCCXs57cXXB1sF=4cifZQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

I'm going to implement inheritance of C++ classes in lablqt and I'm
prototyping test example<https://github.com/Kakadu/lablqt/tree/master/inher>.


Main idea is to wrap C++ classes by some another class, where all public
methods are replaced on calls of caml methods (of course, any this wrapper
classes has a pointer to OCaml object). When some method is called, OCaml
code run and if this method was overriden then caml code runs, else runs
call of C++ method.

Known problems are:
1) test example crashes when it trys to call overriden method (it seems that
it can't find it in table of virtual methods)
2) there are some problem if we try to override non-virtual methods. for
example

class A {
public:
  void foo() { boo(); }
  void boo() {}
};

If we override boo(), initial boo() wil be called ofter calling foo().
3) Maybe will be some difficulties with overriding protected meths.... If
problems are not obvious I'll describe them later.

Btw, I've heared that there was same problems with creating binding for
OClosure, but I've not understanded their realisation yet.

I'll be glad if you can formulate more problems or recommend some solutions
of some problems.

Best wishes,
Kakadu

[-- Attachment #2: Type: text/html, Size: 1788 bytes --]

                 reply	other threads:[~2011-10-10 11:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAGmVoG3iqRCXQOgiwqjZqdV8F8TarNCCXs57cXXB1sF=4cifZQ@mail.gmail.com' \
    --to=kakadu.hafanana@gmail.com \
    --cc=caml-list@inria.fr \
    /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