(C) 2024 Swudu Susuwu, dual licenses: choose GPLv2 or Apache 2 (allows all uses).
If your project can not use C++ includes,
and you cannot wait for issue #3 (C port) to close (or contribute to this),
you have numerous possible tools to use:
cfront
(git clone https://github.com/farisawan-2000/cfront-3.git
)- Cfront may fail to cross-compile some C++-specific tools which require
libstdc++.so
(such asstd::exception
, Standard Template Library) so suggest to use LLVM-Julia.
- Cfront may fail to cross-compile some C++-specific tools which require
- Comeau C/C++ is the new
cfront
(supportslibstdc++.so
tools, but is not FLOSS.) - LLVM-Julia (is FLOSS,
git clone https://github.com/JuliaHubOSS/llvm-cbe.git
) to cross-compile this to C (to allow to import).- Stock LLVM removed
llvm-cbe
(which has-march=c
, the "C-backend"), but LLVM-Julia has this.
- Stock LLVM removed
Chose to use C++ because:
- C++'s "syntactic sugar" reduces code sizes (due to classes, templates, and the Standard Template Library), plus, this abstract syntax allows more room for compiler optimizations of sources.
Most languages allow you to include&use C++ functions.
- If yours does not, and
LLVM-Julia
is not good enough for you, respond to this issue as to how a C version would assist you (will produce if enough ask for this).
To replace C++'s Standard Template Library, ../cxx/ClassObject.hxx
ports Java's java.lang.instrument.Instrumentation
to class Instrumentation
, java.lang.Class
to class Class : public Instrumentation
, java.lang.Object
to class Object : Public Class
.
- It is simple to port those to C, as all this project depends on is C++98's {
throw
, single inheritance}, Standard Template Library, and C++11's {auto
,class { bool defaultMemberInit = true; };
,decltype
,for(value: list) {}
}- Most functions which use
throw
have alternatives whichstd::nothrow
(to allowextern "C" {
).
- Most functions which use