[Ecls-list] Restarting the ECL engine within the same process?

Juan Jose Garcia Ripoll jlr at mpq.mpg.de
Fri Oct 1 04:54:03 UTC 2004


Goffioul Michael wrote:

>I discovered ECL and found it very interesting for our internal
>purpose, which is to embed a LISP engine within a MEX file for
>MATLAB. I didn't try it completely yet, but I have a question
>regarding the possibility to restart the ECL engine within the
>same process.
>Is there a way to cleanly shutdown and restart the LISP engine?
>Note: this is what would happen for an embedded ECL into a MEX file
>when the MEX file is cleared and reloaded in the MATLAB session.
>
Hi Michael,

currently one can not restart the lisp engine because it destructively modifies some data that it uses to create packages, symbols, etc. 

However, AFAIK, you do not need this facility. Matlab compiles your MEX files as DLLs and it loads them only once at the beginning of a program, and unloads them when it finds it suitable. First of all, if Matlab unloads your MEX file, it will also unload the ECL library, and thus the whole system will be cleaned. Calling cl_shutdown() is not really required.

Second, you probably want to call "cl_boot" every time from the function that is exported to Matlab, but only every time  your module is reloaded. The simplest way for that would be to set a static variable

	int ecl_booted;
	....
	if (!ecl_booted) { cl_boot(); ecl_booted++; }

Regards,

Juanjo

-- 
Max-Planck-Institut fuer Quantenoptik	+49/(0)89/32905-345
Hans-Kopfermann-Str. 1, D-85748		www.mpq.mpg.de/Theorygroup/CIRAC/
Garching b. Muenchen, Germany		Juan.Ripoll at mpq.mpg.de






More information about the ecl-devel mailing list