jheruty / hscpp

Runtime compiled C++ with hot-swapped classes.
MIT License
91 stars 5 forks source link

hscpp: A library to hot-reload C++ at runtime

hotswap-cpp (hscpp) is a library that allows C++ to be reloaded at runtime. This can greatly decrease iteration time where small changes are common, such as during game scripting or UI development.

Demonstration Video

This video discusses how hscpp works, and runs through the demos included in the examples folder.

hscpp demonstration video

Documentation

The documentation can be read here.

Getting started

A good way to get started is to review the following demos in order:

These demos build off of one and other to demonstrate core hscpp features.

How it works

hscpp was inspired by and uses the same base approach as Runtime Compiled C++.

When a program that links hscpp is running, the program's source directories will be monitored for changes. When a file is modified, hscpp will recompile it into a dynamic library, and link the newly created library into the running program.

If this new library contains classes registered with hscpp via the HSCPP_TRACK macro, old instances of those classes are deleted and replaced by new instances running the new code.

Features

System requirements

hscpp uses CMake to build, and requires at least a C++11 compiler. Supported operating systems include Windows, macOS, and Linux. When building below C++17, hscpp will use ghc filesystem to support std::filesystem calls.

Current status

hscpp is in alpha. While the library is not currently in active development, it is functional. If you log an issue, I'll do my best to get it addressed as soon as I can.