From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: Re: good examples of Emacs modules? Date: Thu, 31 Mar 2016 23:59:36 +0200 Message-ID: <87poua5mwn.fsf@wanadoo.es> References: <56FC5E99.7090804@cs.ucla.edu> <8737r67jbo.fsf@wanadoo.es> <83a8levbaf.fsf@gnu.org> <87y48y60fi.fsf@wanadoo.es> <834mbmv95h.fsf@gnu.org> <87twjm5rc3.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1459461618 7034 80.91.229.3 (31 Mar 2016 22:00:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Mar 2016 22:00:18 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 01 00:00:06 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1alkdK-0007yo-9l for ged-emacs-devel@m.gmane.org; Fri, 01 Apr 2016 00:00:06 +0200 Original-Received: from localhost ([::1]:34659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alkdG-0007QB-NA for ged-emacs-devel@m.gmane.org; Thu, 31 Mar 2016 18:00:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alkd4-0007Q1-1v for emacs-devel@gnu.org; Thu, 31 Mar 2016 17:59:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alkd0-0000ve-S5 for emacs-devel@gnu.org; Thu, 31 Mar 2016 17:59:50 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:38104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alkd0-0000vX-LS for emacs-devel@gnu.org; Thu, 31 Mar 2016 17:59:46 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1alkcz-0007pk-57 for emacs-devel@gnu.org; Thu, 31 Mar 2016 23:59:45 +0200 Original-Received: from 151.red-79-153-146.dynamicip.rima-tde.net ([79.153.146.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Mar 2016 23:59:45 +0200 Original-Received: from ofv by 151.red-79-153-146.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Mar 2016 23:59:45 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 151.red-79-153-146.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) Cancel-Lock: sha1:8GRxfMdm3Rlh3nPMxmbrPgfnZyM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:202540 Archived-At: Aurélien Aptel writes: > Hi all, > > On Thu, Mar 31, 2016 at 10:23 PM, Óscar Fuentes wrote: >> consequences.) How objects created by the module system interact with >> garbage collection is an start. > > Every emacs_value allocated inside a Lisp-exposed function becomes > invalid when control of the function ends (when it exits) unless you > return that value or you mark it global with the the > env->make_global_ref() API call. Ok. > As I was googling for a browseable emacs git repo to look quickly at > emacs-module.h I've noticed that Syohei Yoshida (cc'ed) has figured a > lot of things out by himself (kudos to you!) and has already made some > simple and not-so-simple modules: Thank you. The more examples, the better. I'll like to encourage you to keep expanding the introduction, though. The type on information it contains saves a lot of head scratching. BTW, it is necessary to explicitly export the symbols on Windows (and on GNU/Linux too depending on the arguments used): int plugin_is_GPL_compatible; should be int __declspec(dllexport) plugin_is_GPL_compatible; (Windows) int __attribute__ ((visibility("default"))) plugin_is_GPL_compatible; (GNU/Linux, when you compile your module with -fvisibility=hidden, which is a Good Thing.) This is usually implemented with a macro. More info: https://gcc.gnu.org/wiki/Visibility That page mentions C++ but it applies to C too. [snip]