> Basically, I wanna pass a string containing the source code of a C function > to some api and be able to call the compiled code. I found that compileAPI > and hcr exist, but couldn't find any examples using C.
You can inline C code in Nim with the `{.emit: myCcode.}` pragma (<https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma>) so if you get HCR running for Nim you can have the proper C code. Now, the whole context is very confusing and doesn't really make sense to me. > the source code of a C function to some api If you have a C API, it's somewhat stable, why would you need to dynamically recompile your API calls? > I'm focusing on using tcc first because it's fast and I need the code > compilation to happen as fast as possible I don't understand why you need to compile something in the first place, either it's an API and it's stable or it's not and if you need fast self-modifying code, use an interpreted language, bytecode VM or a JIT to skip the compilation step.