Hi,
Because Karl uses C++11, it may be theoretically possible for him to load
two different tcc instances having different C++ namespaces and compiled in
two distinct translation units.
tcc1.cpp:
namespace tcc1 {
#include "libtcc.h"
};
Tcc2.cpp:
namespace tcc2 {
#include "libtcc.h"
};
int main() {
tcc1::TCCState* a = nullptr;
char (*A)(int) = nullptr;
assert((a = tcc1::tcc_new()) != nullptr);
tcc2::TCCState* b = tcc2::tcc_new(); // remove this line to make the
program work
//
}
But it may not be so simple. For some projects it worked flawlessly and
failed for some others.
C.
-----Original Message-----
From: Tinycc-devel [mailto:[email protected]]
On Behalf Of Michael Matz
Sent: Friday, May 24, 2019 21:51
To: [email protected]
Subject: Re: [Tinycc-devel] Two compilers at once
Hello,
On Fri, 24 May 2019, Karl Yerkes wrote:
> As long as I make the second compiler after the first one compiles
> something, things work. is this a bug? Is using two compilers
> unsupported or prohibited?
libtcc contains some global state, i.e. shared between TCCState objects
you create. Some of this sharing is harmless, some of it isn't; the
latter is the reason why two compile objects generally don't work except
by accident. Fixing this implies adding one indirection, and some of that
state is used in extremely performance critical code, so it has never been
a priority.
So, yeah, it's a current limitation of libtcc.
Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel