How to dynamically load often re-generated c code quickly?

前端 未结 4 1868
遥遥无期
遥遥无期 2020-12-01 17:00

I want to be able to generate C code dynamically and re-load it quickly into my running C program.

I am on Linux, how could this be done?

Can a library .so f

4条回答
  •  日久生厌
    2020-12-01 17:57

    Are you sure C is the right answer here? There are various interpreted languages such as Lua, Bigloo Scheme, or perhaps even Python that embed very well into an existing C application. You can write the dynamic parts using the extension language, which will support reloading code at runtime.

    The obvious disadvantage is performance - if you absolutely need the raw speed of compiled C then these may be a no-go.

提交回复
热议问题