- Subject: Re: [slang-users] slc2c - made an includer, want feedback
- From: Michael Noble <mnoble@xxxxxxxxxxxxx>
- Date: Mon, 5 Jan 2004 16:42:11 -0500
> I am curious of what you think of my idea. I have created (converted) an
> optional utility that is used with Lua which takes a compiled SLang
> file, reads it in binary mode, creates a function sorta like:
>
> void hello() {
> const unsigned char B1[] = { 12, 20, 10, ... ... };
> SLang_load_string(B1);
> }
>
> Now, in your C application where you want to provide both C intrinsics
> and also some code written in S-Lang, you can do something like:
>
> #include "hello.c"
>
> void main() {
> SLang_init_all();
> hello();
> SLang_load_file("whatsup.sl");
> }
This approach can be useful for creating "standalone" applications built
from collections of scripts. There is a "mktclapp" utility, at
http://www.hwaci.com/sw/mktclapp/
which does a similar thing, plus a bit more, for the Tcl language. It
supports embedding scripts as static/constant C strings (which are passed
to an eval() mechanism at runtime), as well the inclusion of binary data
files, although I don't know if it will embed compiled Tcl byte codes.
By way of example, the very popular astronomical imaging tool, DS9
(written at the Smithsonian Astrophysical Observatory), uses mktclapp
to compile its Tcl scripts into C/C++ code, in order to create a
binary distribution containing only 1 file: a statically linked ds9
executable, with zero external dependencies.
This makes installing ds9 _very_ simple: just drop a copy onto your
disk and it's ready to go ... no gnu-configuring, no building, no
installing scripts into system directories, no library version
mismatches, etc, and Tcl/Tk is not even required to be installed
on the system.
Regards,
-Mike
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2004 date index]
[2004 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]