From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.help Subject: Re: Emacs modules 25.1 Date: Tue, 27 Sep 2016 15:36:13 +0000 Message-ID: References: <709716874.935191.1474913256978.ref@mail.yahoo.com> <709716874.935191.1474913256978@mail.yahoo.com> <1273225869.1442197.1474978988432@mail.yahoo.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1474993277 25075 195.159.176.226 (27 Sep 2016 16:21:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2016 16:21:17 +0000 (UTC) To: Mambo Levis , "help-gnu-emacs@gnu.org" , "johnw@newartisans.com" , "bozhidar@batsov.com" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 27 18:21:13 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bov7w-0005FB-RB for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Sep 2016 18:21:04 +0200 Original-Received: from localhost ([::1]:52178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bov7v-0004wR-3Z for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Sep 2016 12:21:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bouQl-0000Fy-3N for help-gnu-emacs@gnu.org; Tue, 27 Sep 2016 11:36:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bouQj-0007za-6Z for help-gnu-emacs@gnu.org; Tue, 27 Sep 2016 11:36:26 -0400 Original-Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:36584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bouQi-0007zJ-W0 for help-gnu-emacs@gnu.org; Tue, 27 Sep 2016 11:36:25 -0400 Original-Received: by mail-wm0-x231.google.com with SMTP id w84so182644835wmg.1 for ; Tue, 27 Sep 2016 08:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Dg0xtqD1U1ePpevDMjNVKFkILuEa/TPlf86YyOvYbXk=; b=hbxsiKGUzE/AgCNfM9SiG7cX6+R2V8J/dG7raTMonIRKDyYjN7r0OBoDpgF2iMqhIG q8OBqbIcf60bFoCaU4iLDXbxgN84h5JFvKO0RnScbOB/N9MFDj+pTRyQ/Kjp6QJ/akIW dyDhKJ8BB86f5oepMc6ymsouWqX2mQH8jNy4QOZDhBnE/pe4ffl3NH5ryi5Z+kMM8n9l BnSzgrjy+nFFD+5GyyueGqx0tLaPAdoPNB+DqED2AVb5EuwwEo8O0Ze8vMutCTolfFtn BbMVIcBHmaT72ClciGQSC9Zarp7heH4CH4He/Dl7PhQc8sNgaLN4VC/Z53Xr4vXfUk8V fugA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Dg0xtqD1U1ePpevDMjNVKFkILuEa/TPlf86YyOvYbXk=; b=Ffr9tnaCSBhoQg1FlUByhs3Ik/kE/cpwSPm6FRWy88pnixCiwOB4f7BNOuuLSJR06O 6p4gxuI6/eekKJFcqsQIMt+Y6tg9YOjrukYh2tSQghLh7eIHBX3z0ZBgeOTPDMkoA4t9 S52F5ALIWAm36MxUHWg29qq8WBD3d9aur3IB4ptLtIbCvuoHuAsf8IAYzvc4yrT/pNEq weqvmzEI5QpilO/rR/63UERhhkeP2xpMwLMZmcpO5sz9ZHuIp7TJNOdbptCtuCpHLq5o stnUYlmvV+JZHkS7cXPXBOkpiqodEyAyLJyvYArOi/i5RQtCibNjvUz6SdtpklLLJhJY 5X1g== X-Gm-Message-State: AA6/9RncnYZFcIQ/pPjYJsrL9KAcULWsDM7v2ICUPn69MWm3aWL4q5UYLcdTblzzW7AVcFKhVJjuglES6DxEjg== X-Received: by 10.28.104.4 with SMTP id d4mr2676923wmc.52.1474990583964; Tue, 27 Sep 2016 08:36:23 -0700 (PDT) In-Reply-To: <1273225869.1442197.1474978988432@mail.yahoo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::231 X-Mailman-Approved-At: Tue, 27 Sep 2016 12:20:07 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111412 Archived-At: 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++ exception.