Re: c++ sources compilation at runtime
On 5/5/2010 11:31 AM, davide galassi wrote:
[..] EXIST an open source library to compile
a c++ source at runtime?
I don't know of any. However, knowing that GCC is open source, making
it into a library is probably not such a huge undertaking...
i know that to compile a source i have to invoke a compiler... but i
don't want to include gcc or the visual stdio compiler as a binary in
my engine. instead i want to include the sources of a library to
compile at runtime.
I found the TCC compiler (http://bellard.org/tcc/) that has the LIBTCC
to compile at runtime a C program passed as a string in memory. but i
need a c++ solution.
PS: i want to do this because a want that the user of my engine don't
have to know how internally the engine will execute his c++ source
code and he simply have to write a c++ program and pass the path to
the engine...
I think now i've been more clear.
Yes, so shaders have nothing to do with it. I get it.
Allowing user to execute any arbitrary C++ code inside your process as a
DLL is *extremely* dangerous and open to security issues nobody wants to
deal with, and that's probably why this has never been considered of any
interest, and that's why there is no solution (even partial) to do what
you think you need. Consider a C++ interpreter. Google for it. The
performance is not there, but at least it will do *some* of what you
looking for.
If the language is not the limitation (and you're open to trying other
solutions like Python or Ruby), there are embedded interpreters on the
market, and some are probably free.
V
--
I do not respond to top-posted replies, please don't ask