tinycc-devel
[Top][All Lists]
Advanced

[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: David Mertens
Subject: Re: [Tinycc-devel] Use tcc to make embedded just-in-time compile/interpreter
Date: Sun, 18 Dec 2011 15:41:59 -0600

One reason to use tcc over these others is that it's dead simple to hand C code to libtcc and get a function pointer back (with a few steps, of course). Couldn't find such a simple working example for any other system myself.

On Dec 17, 2011 1:12 PM, "Basile Starynkevitch" <address@hidden> 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)?

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} ***

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]