[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs modules 25.1

From: Philipp Stephani
Subject: Re: Emacs modules 25.1
Date: Tue, 27 Sep 2016 15:36:13 +0000

Mambo Levis <> 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++

reply via email to

[Prev in Thread] Current Thread [Next in Thread]