[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Use tcc to make embedded just-in-time compile/interpr
From: |
Basile Starynkevitch |
Subject: |
Re: [Tinycc-devel] Use tcc to make embedded just-in-time compile/interpreter |
Date: |
Sat, 17 Dec 2011 19:33:37 +0100 |
On Fri, 16 Dec 2011 14:31:31 +0100
Benoit Gschwind <address@hidden> wrote:
> Hello,
>
> I would like to create an embedded C interpreter/compiler.
>
> The idea is to allow user to write plugin/add-on in C plain text in and
> be able to load this code and execute it inside program. Actualy, if you
> want add script capability into program you have to use lua or python or
> other interpreted language. This project want to be an alternative.
Other have answered about libtcc.h, but why do you want the user to write code
in C
specifically (as opposed to some higher-level scripting language)?
And in addition of using tinycc & libtcc.h (with tcc_add_file or
tcc_compile_string), you
also have the possibility of writing the C file into a temporary file foo.c,
compile it
with optimizations by forking a gcc -fPIC -shared -O -o foo.so foo.c, then
dlopen-ing the
foo.so (a process can dlopen many thousands *.so files on Linux).
You could also use GNU lightning, libjit, or LLVM to generate machine code....
Cheers.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***