Quote
Your AllocDebugConsole() function is a nice idea and I will add it into the next version of the newLISP DLL.
I'm very glad to hear that. : )
Quote
Rather then running multiple instances of newLISP in the same DLL, I would run multiple instances of newlisp.exe and import Windows GUI functions using 'import' and do callbacks using 'callback'. There is a good example of this in newlisp-x.x.x/examples/win32demo.lsp. This demo was written by Cyril Slobin and you can also access it at:http://slobin.pp.ru/newlisp/win32demo.lsp">http://slobin.pp.ru/newlisp/win32demo.lsp
On multicore CPUs this solution will scale much better than multiple threads in the same DLL, because the OS will distribute the different newlisp.exe processes on to different cores and you have a solution working on Windows and UNIX at the same time.
Thanks for your suggestion.
I think multiple instance of newlisp.exe to build a server side program is the nice way, for example: use a listener(dispatcher) instance and multiple instance to run actual things.
Back to the topic, if I use your solution in a GUI application formally, some problems are appear:
1. For people of China, most of them enjoy GUI applications generally, and most people use the Microsoft Windows. A multiple instance GUI program would puzzling them, for example: they will consider the program as virus. : (
2. While the GUI main program crash, multiple child instance are hard to be terminate. (Users were stupid generally, while the single executable application carshed, they could restart it simply.)
3. Of the exist GUI program, I had built it for a long time, with many C++ wrapper GUI class. I tired to rebuild it with full newlisp script.
So, I use the way of my posted, create multiple ENVCONTEXT to solution my problems, I think it's has these merits:
1. A easy way to resolve the above problems.
2. Make data exchange easier.
For example 1:
In multiple thread mode, I can exchange data between multiple ENVCONTEXT simply as use same synchronization methods.
For example 2:
I can use the way to make the separate newlisp environment startup faster, if I want to startup many newlisp instance, and each of them must load the startup script, while the script be larger, multiple instance will cost a long time.
In my solution, I can create a init ENVCONTEXT and let it to load the startup script, the second ENVCONTEXT I let it simply clone the init ENVCONTEXT's data, and the third ENVCONTEXT clone the data from init ENVCONTEXT also ...
I think onn multicore CPUs my solution will also effective, the multiple threads on Windows can be distributed to different cores as well as multiple process.
I am not sure if I am correct. : )