On Tue, 21 Dec 2021, Dimitris Papavasiliou <dpapa...@protonmail.ch> 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