unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Mambo Levis <mambo.levis@gmail.com>,
	 "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>,
	"johnw@newartisans.com" <johnw@newartisans.com>,
	 "bozhidar@batsov.com" <bozhidar@batsov.com>
Subject: Re: Emacs modules 25.1
Date: Tue, 27 Sep 2016 15:36:13 +0000	[thread overview]
Message-ID: <CAArVCkQKizkLiZ7vyDZ18PU99FYzjO2cYsz6vSSOTEE9m32Ngg@mail.gmail.com> (raw)
In-Reply-To: <1273225869.1442197.1474978988432@mail.yahoo.com>

Mambo Levis <mambo.levis@gmail.com> schrieb am Di., 27. Sep. 2016 um
14:26 Uhr:

> Hi,
> I found the problem and now I can build the emacs_module example using g++.
> That's means that I eventually can create a c++ wrapper, but I would like
> to listen to your advice because I don't knowif there is a fundamental
> issue that I'm ignoring. So, only one question is still open?
> 1. Is it possible to create a C++ wrapper around emacs_modules and what
> are the implications?
>

Yes, it's possible. The main implication is that you need to translate
between C++ exceptions and Lisp signals. In particular, any function called
from Emacs (emacs_module_init, functions registered via make_function) need
to surround their body with

try {
   // ...
} catch (...) {
   // ...
}

The module API makes an attempt to prevent leaking exceptions out of C++
code by forcing module functions to be declared noexcept, however this
causes any uncaught exception to crash Emacs, so you'll probably want to
catch and handle them.
Not required, but probably useful, is to also perform the translation in
the opposite direction: When a non-local Lisp exit happens, throw a C++
exception.


      parent reply	other threads:[~2016-09-27 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <709716874.935191.1474913256978.ref@mail.yahoo.com>
2016-09-26 18:07 ` Emacs modules 25.1 Mambo Levis
2016-09-27 12:23   ` Mambo Levis
2016-09-27 14:55     ` Eli Zaretskii
2016-09-27 15:36     ` Philipp Stephani [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAArVCkQKizkLiZ7vyDZ18PU99FYzjO2cYsz6vSSOTEE9m32Ngg@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=bozhidar@batsov.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=johnw@newartisans.com \
    --cc=mambo.levis@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).