From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Emacs ffi (was: Re: as for Calc and the math library) Date: Thu, 15 Aug 2024 05:31:49 -0400 Message-ID: References: <864j7qhup6.fsf@gnu.org> <87a5hi0yts.fsf@valhala.localdomain> <86y152ge0b.fsf@gnu.org> <86jzgjfwqp.fsf@gnu.org> <87sev78arx.fsf@gmail.com> <86le0z89u1.fsf@gnu.org> <87o75v87n1.fsf@gmail.com> <86frr786k7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5143"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Suhail Singh , gerd.moellmann@gmail.com, nicolas@n16f.net, arthur.miller@live.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 15 11:32:43 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1seWqZ-00018Y-26 for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Aug 2024 11:32:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1seWpp-00063Q-Ly; Thu, 15 Aug 2024 05:31:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seWpn-00063F-Ic for emacs-devel@gnu.org; Thu, 15 Aug 2024 05:31:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seWpm-0005if-Vg; Thu, 15 Aug 2024 05:31:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=/Liw3+8kmx/wYi8qrDrcdNuc2Y5Z3msgMZaHKj+5hWk=; b=I6jD8RCmc4r94ot7H/0X JzlMZhgL/gOqLNgoqLi5Ns+hrEPnBGO8oHRV+Wd8ISUAsWORa9B1tSYHGxIA2xthcdvxUzI1QlU3s OSCUtepW3LpXPj3Z0z7qePAsNaoo6zJzO1MKTKI033bKxyIknimrCUHgv1VvSuEzObeBa1QdPGgU3 mfwplbTq1118sgi9kJ/Vz3ZVhj6hXLTYg555+c47QcbVdE9u6mgWnypG3aP4UlfX+yJc4Dbmh4CMM 7qDj9AE3ZX1/qUsCyjghmH3O733enG/5XLjDxJRTE4aCM1NQ9jWGvP0mH5kJ+ljJOmtcXvqrap+se YwCImracq75tDg==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1seWph-0007ul-Op; Thu, 15 Aug 2024 05:31:54 -0400 In-Reply-To: <86frr786k7.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Aug 2024 18:31:20 +0300") X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322775 Archived-At: Eli Zaretskii writes: >> From: Suhail Singh >> Cc: Suhail Singh , gerd.moellmann@gmail.com, >> nicolas@n16f.net, arthur.miller@live.com, emacs-devel@gnu.org >> Date: Wed, 14 Aug 2024 11:08:02 -0400 >> >> Eli Zaretskii writes: >> >> >> On the topic of what would be acceptable for an FFI, wouldn't something >> >> akin to what's done for modules be sufficient ? I.e., have the users of >> >> the interface explicitly state that they are compliant. >> >> >> >> It would scale better than an allow-list. IIUC, Arthur mentioned this >> >> in another thread. If this wouldn't be sufficient for an FFI, could you >> >> please elaborate on why that's the case ? >> > >> > What exactly are you suggesting? IOW, please describe what you have >> > in mind in more detail, because I don't think I understand it. >> >> Specifically, modify the `define-ffi-library' macro that emacs-ffi >> provides. >> >> Presently, it takes two arguments: a SYMBOL and a NAME. I am proposing >> that it be updated to take three arguments: a SYMBOL, a NAME and a >> GPL-COMPATIBLE-P token. A value of `t' would be necessary for creating >> a reference to the library. > > And if the value is not t, then the load will fail? If so, then this > additional argument makes very little sense: you could instead say > that just by loading the library, the Lisp program which uses > emacs-ffi "declares" the loaded library to be GPL-compatible. And we > are back where we began. Agree > The way we do it when loading modules requires the _loaded_ library to > declare itself compatible, by exporting a symbol of a certain name. > That is an action by the library we load, not by the Lisp program > which loads it. But we could do the same for our hypothetical ffi machinery, that is: `define-ffi-library' could fail if the shared library is not exporting the predetermined symbol we expect no? Andrea