[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: |
Benoit Gschwind |
Subject: |
Re: [Tinycc-devel] Use tcc to make embedded just-in-time compile/interpreter |
Date: |
Sun, 18 Dec 2011 22:01:32 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111211 Thunderbird/8.0 |
On 17/12/2011 19:33, Basile Starynkevitch wrote:
> 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)?
Why not? for performance, for lightness, for sport. Why use some new
language when everything is ok with an existing good language? There is
tones of high-level scripting language and tones of low-level language,
they have there advantages and there issues. The aim is to fill an empty
slot, add one more choice.
Personally I prefer code in C or C++.
>
> And in addition of using tinycc & libtcc.h (with tcc_add_file or
> tcc_compile_string), you
I currently check libtcc.h and this seem to be a good starting point.
More than I expected.
> 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).
I thinked about this way but it's quite dirty, it is not so different
than ./configure && make then run.
> You could also use GNU lightning, libjit, or LLVM to generate machine code....
I don't really know them (I know them by name). I will have a look.
> Cheers.
>
Thanks for your contribution