[Ecls-list] Embedding ECL inside a containing C++ program.

Andrew Topp talmakion at yahoo.com.au
Sat Aug 17 09:22:06 UTC 2002


The project I'm working on is Universal Corporation
(http://sourceforge.net/projects/unicorp). 

I'm attempting to embed the ECL Lisp interpreter
within UniCorp as its scripting engine, console
command interpreter and UI manager, among other things
I can't recall atm. A while ago I tried this with
ECLS-0.5, but it wouldn't work on Windows (I'm
developing on Linux but maintaining a Win32 port), and
Crystal Space (the 3D SDK that UniCorp uses) builds
using Mingw, which wasn't a particularily well
supported target.

I've upgraded to CVS at last (the advice issued at the
time), but now I've run into another problem.

I'd like the input from the graphical console to be
fed into the Lisp top-level. I'd like the output to be
displayed on the graphical console. Looking over the
guts of print.d and file.d doesn't seem to offer much
help.

I've hacked up my CVS version slightly and
incorporated it into the UC tree (mainly
Makefile/configure modifications to work with the
Makefile-only UC build system. Still working on Mingw
combatability (sic)). The Lisp plugin for UC is an
SCF-loadable dynamic link library separate from the
backend.. I've had no problems linking all the ECL
static libs into the shared lib plugin and calling
cl_boot(). I know it works because UC now takes a lot
longer to initialize:), during the plugin-init phase.

I've considered using make_string_*_stream() and
changing PRINTstream and the Lisp streams
*standard-input*, etc, but this seemed messy and
difficult. Additionally, the Lisp plugin can't hold
the CPU waiting for input (eval() can be used for
console-command-line stuff, but if the debugger starts
due to an error, it'll want real input), because UC
isn't multi-threaded. For the same reason, using a
socketpair or similar and overriding stdin/stdout
won't work. Apart from this, these solutions are all
inelegant.

Basically, now I'm getting to the actual question, how
can I make ECL work in CS's event-driven environment
(incoming input events, outgoing output events)?

Thanks for any suggestions and advice in advance,

>> Andrew (talmakion at yahoo.com.au)

http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!




More information about the ecl-devel mailing list