From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Olivier Dion via General Guile related discussions Newsgroups: gmane.lisp.guile.user Subject: Re: Need help embedding Guile Date: Tue, 21 Dec 2021 17:39:56 -0500 Message-ID: <87ee65shtv.fsf@laura> References: <2a789e248ef8d1922caec7af553cf26e9b360619.camel@telenet.be> Reply-To: Olivier Dion Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8417"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "guile-user@gnu.org" To: Dimitris Papavasiliou , Maxime Devos Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Dec 21 23:40:41 2021 Return-path: Envelope-to: guile-user@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 1mznoG-000203-HB for guile-user@m.gmane-mx.org; Tue, 21 Dec 2021 23:40:40 +0100 Original-Received: from localhost ([::1]:32980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mznoF-0005Gi-FQ for guile-user@m.gmane-mx.org; Tue, 21 Dec 2021 17:40:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mznnn-0005Fr-SW for guile-user@gnu.org; Tue, 21 Dec 2021 17:40:13 -0500 Original-Received: from smtp.polymtl.ca ([132.207.4.11]:43343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mznnl-0000ms-Lh for guile-user@gnu.org; Tue, 21 Dec 2021 17:40:11 -0500 Original-Received: from localhost (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 1BLMdvZS019540 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Dec 2021 17:40:02 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1BLMdvZS019540 In-Reply-To: X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Tue, 21 Dec 2021 22:39:57 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17898 Archived-At: On Tue, 21 Dec 2021, Dimitris Papavasiliou wrote: > The idea is that the C++ program, after some initialization, loads and evaluates > one or more Scheme files (provided by the user as command line arguments). > During the course of their evaluation, these create objects on the C++ side > (representing the work that is to be done) and, once they're evaluated the work > of Guile is done. At that point, ideally, I'd like to deinitialize/terminate > Guile, both to reclaim resources which are no longer necessary and to ensure > that it plays no further role in the execution of the rest of the program. As > far as I can see, this is not possible. >From this description, what I understand is that you want to use Scheme as a configuration file for batching the operations to be done in a second phase in C++. However, I failed to see why you need to finalize these objects since you're going to use them in your second phase? > If anyone has any comments or ideas, they would be most welcome. One way I think of would be to fork the process and create your C++ objects in a shared memory area between the parent and the child. Once Guile is done reading your inputs, the child process dies and all its memory is reclaimed by the OS. > I'd appreciate some confirmation of the validity of my approach and > also some tips on a couple of loose ends. I think it's a valid approach. -- Olivier Dion Polymtl