metgang / tccwrapper Goto Github PK
View Code? Open in Web Editor NEWConvenient header-only C++17 wrapper to use with embedded Tiny C Compiler (tcc)
License: MIT License
Convenient header-only C++17 wrapper to use with embedded Tiny C Compiler (tcc)
License: MIT License
TCCState* s = tcc_new();
tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
if (tcc_compile_string(s, buf) != -1)
{
int size = tcc_relocate(s, nullptr);
if (size > 0)
{
void* mem = malloc(size);
tcc_relocate(s, mem);
ret = ((uint8_t*)tcc_get_symbol(s,"xxxxxxxxx")) ;
free(mem);
}
}
tcc_delete(s);
Thank you for your work. I found that there are compilation errors in vs 2019. Can you release the complete project version
Does not support the latest version of vs2022? Choosing to support c + + 20 still doesn't work, and the last version works well
Hi, Can you give more example of TccWrapper?
I try to use 'RegisterMethod' ๏ผ it seems can complie ,but will not run correctly ( certainly! without an instance will cause exception)
Code like this:
class A
{
public:
int GetValue();
private:
int i;
}
std::optional<tw::TccWrapper> optTccWraper = tw::TccWrapper::WithOptContext();
optTccWraper->RegisterMethod<&A::GetValue>("GetValue"); //This can complie well
const char ccc[] = R"(
extern int GetValue();
int Test()
{
return GetValue();
};
)";
optTccWraper->AddSourceCode(ccc);
optTccWraper->Compile();
int i = optTccWraper->Call<int>("Test");
Environment :
Windows10
Visual studio 2019
I think like std::bind , It need class instance .
Can you give me an example ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.