### Install CPyCppyy Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Set up a virtual environment and install CPyCppyy. ```bash python3 -m venv .venv source .venv/bin/activate ``` ```bash git clone --depth=1 https://github.com/compiler-research/CPyCppyy.git mkdir CPyCppyy/build cd CPyCppyy/build cmake .. cmake --build . ``` ```bash export CPYCPPYY_DIR=$PWD cd ../.. ``` ```bash export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR ``` -------------------------------- ### Install Project Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Install the project using emmake after all tests have passed successfully. Utilizes all available CPU cores for faster compilation. ```bash emmake make -j $(nproc --all) install ``` -------------------------------- ### Install CPyCppyy Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Set up the virtual environment and build CPyCppyy. ```bash python3 -m venv .venv source .venv/bin/activate git clone --depth=1 https://github.com/compiler-research/CPyCppyy.git mkdir CPyCppyy/build cd CPyCppyy/build cmake .. cmake --build . ``` -------------------------------- ### Activate Environment and Run Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Activate the virtual environment and verify the installation. ```bash source .venv/bin/activate ``` ```bash python -c “import cppyy” ``` -------------------------------- ### Build and Install CppInterOp Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Build and install CppInterOp using CMake. Ensure that LLVM_DIR and Clang_DIR are correctly set, and specify the installation prefix. The shared libraries are built by default. ```bash mkdir CppInterOp/build/ cd CppInterOp/build/ cmake -DBUILD_SHARED_LIBS=ON -DLLVM_DIR=$LLVM_DIR/build/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/build/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. cmake --build . --target install --parallel $(nproc --all) ``` -------------------------------- ### Configure and Build CppInterOp Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Configure the CppInterOp build using CMake, specifying Cling integration and installation prefix. Then, build and install CppInterOp. ```powershell mkdir CppInterOp\build\ cd CppInterOp\build\ cmake -DCPPINTEROP_USE_CLING=ON -DCPPINTEROP_USE_REPL=Off -DCling_DIR=$env:LLVM_DIR\build\tools\cling -DLLVM_DIR=$env:LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$env:LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR .. cmake --build . --target install --parallel $env:ncpus ``` -------------------------------- ### Build CppInterOp Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Build and install the CppInterOp library. ```bash mkdir CppInterOp/build/ cd CppInterOp/build/ cmake -DBUILD_SHARED_LIBS=ON -DCPPINTEROP_USE_CLING=ON -DCPPINTEROP_USE_REPL=Off -DCling_DIR=$LLVM_DIR/build/tools/cling -DLLVM_DIR=$LLVM_DIR/build/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/build/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. cmake --build . --target install --parallel $(nproc --all) ``` -------------------------------- ### Install C++ Project with Emmake Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Installs a C++ project after successful compilation. Ensure you are in the correct build directory. ```bash cd ../.. emmake make -j $(nproc --all) install ``` -------------------------------- ### Setup Clang-REPL Repository Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Clone the LLVM project release branch for Clang-REPL integration. ```bash git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git cd llvm-project ``` -------------------------------- ### Install cppyy Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Install the cppyy package from source. ```bash git clone --depth=1 https://github.com/compiler-research/cppyy.git cd cppyy python -m pip install --upgrade . --no-deps --no-build-isolation cd .. ``` -------------------------------- ### Build and Install cppyy-backend Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Build the backend and copy library files to the python directory. ```bash cd cppyy-backend mkdir -p python/cppyy_backend/lib build cd build cmake -DCppInterOp_DIR=$CPPINTEROP_DIR .. cmake --build . ``` ```bash cp libcppyy-backend.so ../python/cppyy_backend/lib/ ``` ```bash cp libcppyy-backend.dylib ../python/cppyy_backend/lib/ ``` ```bash cd ../.. ``` -------------------------------- ### Install Chrome and Firefox on Ubuntu x86 Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Download and set up Google Chrome and Mozilla Firefox for testing on Ubuntu x86. Exports PATH for both browsers. ```bash wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb dpkg-deb -x google-chrome-stable_current_amd64.deb $PWD/chrome cd ./chrome/opt/google/chrome/ export PATH="$PWD:$PATH" cd - wget https://ftp.mozilla.org/pub/firefox/releases/138.0.1/linux-x86_64/en-GB/firefox-138.0.1.tar.xz tar -xJf firefox-138.0.1.tar.xz cd ./firefox export PATH="$PWD:$PATH" cd - ``` -------------------------------- ### Initialize Conda Environment for Wasm Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Setup the CppInterOp environment using micromamba. ```bash cd ../../CppInterOp/ micromamba create -f environment-wasm.yml --platform=emscripten-wasm32 -c https://prefix.dev/emscripten-forge-4x -c https://prefix.dev/conda-forge micromamba activate CppInterOp-wasm ``` -------------------------------- ### Install and Activate Emsdk Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Commands to install and activate version 4.0.9 of the emsdk toolchain. ```bash git clone https://github.com/emscripten-core/emsdk.git ./emsdk/emsdk install 4.0.9 ``` ```bash ./emsdk/emsdk activate 4.0.9 source ./emsdk/emsdk_env.sh export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot ``` ```powershell .\emsdk\emsdk activate 4.0.9 .\emsdk\emsdk_env.ps1 $env:PWD_DIR= $PWD.Path $env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot" ``` -------------------------------- ### Build CppInterOp on Windows Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Compiling and installing CppInterOp using CMake. ```powershell mkdir CppInterOp\build\ cd CppInterOp\build\ cmake -DLLVM_DIR=$env:LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$env:LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR .. cmake --build . --target install --parallel $env:ncpus ``` -------------------------------- ### Download and Extract Firefox on Ubuntu x86 Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Installs Firefox on Ubuntu x86 by downloading and extracting a tarball. ```bash wget https://ftp.mozilla.org/pub/firefox/releases/138.0.1/linux-x86_64/en-GB/firefox-138.0.1.tar.xz tar -xJf firefox-138.0.1.tar.xz cd ./firefox export PATH="$PWD:$PATH" cd - ``` -------------------------------- ### Install C++ Interop Header Files Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Installs the public header files for C++ Interop. This makes the library's API available to other projects. ```cmake install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.def" PATTERN "*.h" PATTERN ".svn" EXCLUDE ) ``` -------------------------------- ### Install Firefox for Headless Testing Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Download and configure Firefox on macOS for headless browser testing. ```bash wget "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" -O Firefox-latest.dmg hdiutil attach Firefox-latest.dmg cp -r /Volumes/Firefox/Firefox.app $PWD hdiutil detach /Volumes/Firefox cd ./Firefox.app/Contents/MacOS/ export PATH="$PWD:$PATH" cd - ``` -------------------------------- ### Install C++ Interop Tool Headers Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Installs header files located in the 'tools' directory to the C++ Interop include path. These might be for internal tools or utilities. ```cmake install(DIRECTORY tools/ DESTINATION include/CppInterOp/tools FILES_MATCHING PATTERN "*.h" ) ``` -------------------------------- ### Build Cling and LLVM on Linux/macOS Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Use these commands to clone the Cling and llvm-project repositories and build them using CMake. Ensure you have the necessary build tools installed. ```bash git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git mkdir llvm-project/build cd llvm-project/build cake -DLLVM_ENABLE_PROJECTS=clang \ -DLLVM_EXTERNAL_PROJECTS=cling \ -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \ -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ -DCLANG_ENABLE_ARCMT=OFF \ -DCLANG_ENABLE_FORMAT=OFF \ -DCLANG_ENABLE_BOOTSTRAP=OFF \ ../llvm cake --build . --target clang --parallel $(nproc --all) cake --build . --target cling --parallel $(nproc --all) ``` -------------------------------- ### Download and Expand Google Chrome on Ubuntu x86 Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Installs Google Chrome on Ubuntu x86 using wget and dpkg-deb for testing. ```bash wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb dpkg-deb -x google-chrome-stable_current_amd64.deb $PWD/chrome cd ./chrome/opt/google/chrome/ export PATH="$PWD:$PATH" cd - ``` -------------------------------- ### Download and Extract Firefox on Ubuntu Arm Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Installs Firefox on Ubuntu Arm by downloading and extracting a tarball. ```bash wget https://ftp.mozilla.org/pub/firefox/releases/138.0.1/linux-aarch64/en-GB/firefox-138.0.1.tar.xz tar -xJf firefox-138.0.1.tar.xz cd ./firefox export PATH="$PWD:$PATH" cd - ``` -------------------------------- ### Get All Include Paths Source: https://context7.com/compiler-research/cppinterop/llms.txt Retrieves all configured include paths. Set `withSystem` to true to include system paths and `withFlags` to include compiler flags. ```cpp // Get all include paths std::vector allIncludes; Cpp::GetIncludePaths(allIncludes, /*withSystem=*/true, /*withFlags=*/true); ``` -------------------------------- ### Configure CppInterOp Environment Variables (Linux/macOS) Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Define CB_PYTHON_DIR and CPPINTEROP_DIR for CppInterOp setup. These variables point to the Python backend and CppInterOp backend directories, respectively. ```bash export CB_PYTHON_DIR="$PWD/cppyy-backend/python" export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend" ``` -------------------------------- ### Serve Jupyter Lite with xeus-lite-host on Linux/macOS Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Sets up and serves a local Jupyter Lite instance with the xeus-cpp kernel. This command creates a new conda environment and starts the Jupyter Lite server with specified notebooks and configurations. ```bash cd ../.. micromamba create -n xeus-lite-host jupyterlite-core jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge micromamba activate xeus-lite-host jupyter lite serve --XeusAddon.prefix=$PREFIX \ --contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb \ --contents xeus-cpp/notebooks/tinyraytracer.ipynb \ --contents xeus-cpp/notebooks/images/marie.png \ --contents xeus-cpp/notebooks/audio/audio.wav \ --XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \ --XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" ``` -------------------------------- ### Example Usage of CppInterOp Layer Source: https://github.com/compiler-research/cppinterop/blob/main/docs/tutorials.md Demonstrates the creation of Python types that wrap C++ classes and methods using the CppInterOpLayerWrapper and TemplateWrapper. This includes setting up class handles and method wrappers. ```python if __name__ == '__main__': # create a couple of types to play with CppA = type('A', (), { 'handle' : gIL.get_scope('A'), '__new__' : cpp_allocate }) h = gIL.get_scope('B') CppB = type('B', (CppA,), { 'handle' : h, '__new__' : cpp_allocate, 'callme' : TemplateWrapper(h, 'callme') }) CppC = type('C', (), { 'handle' : gIL.get_scope('C'), '__new__' : cpp_allocate }) ``` -------------------------------- ### Serve Jupyter Lite with xeus-lite-host on Windows Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Sets up and serves a local Jupyter Lite instance with the xeus-cpp kernel on Windows. This command creates a new conda environment and starts the Jupyter Lite server with specified notebooks and configurations. ```powershell cd ..\..\nmicromamba create -n xeus-lite-host jupyterlite-core jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge micromamba activate xeus-lite-host jupyter lite serve --XeusAddon.prefix="$env:PREFIX" ` --contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb ` --contents xeus-cpp/notebooks/tinyraytracer.ipynb ` --contents xeus-cpp/notebooks/images/marie.png ` --contents xeus-cpp/notebooks/audio/audio.wav ` --XeusAddon.mounts="$env:PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" ` --XeusAddon.mounts="$env:PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" ``` -------------------------------- ### Run Tests in Firefox and Chrome (Ubuntu x86) Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Execute C++ interoperability tests in Firefox and Google Chrome on Ubuntu x86. Assumes browsers are installed and in PATH. ```bash echo "Running CppInterOpTests in Firefox" emrun --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Firefox" emrun --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html echo "Running CppInterOpTests in Google Chrome" emrun --browser="google-chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Google Chrome" emrun --browser="google-chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html ``` -------------------------------- ### Get CppInterOp Library Version Source: https://context7.com/compiler-research/cppinterop/llms.txt Retrieves the version string of the CppInterOp library. Example output: "CppInterOp version 2.0.0". ```cpp // Get library version std::string version = Cpp::GetVersion(); // e.g., "CppInterOp version 2.0.0" ``` -------------------------------- ### Create and Enter Build Directory Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Initial steps to prepare the workspace directory. ```bash mkdir CppInterOp-wasm ``` ```bash cd ./CppInterOp-wasm ``` -------------------------------- ### Project Initialization and Path Handling Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Normalizes paths, sets RTTI configuration, and includes necessary LLVM modules. ```cmake string(REPLACE "\\" "/" LLVM_DIR "${LLVM_DIR}") # When in debug mode the llvm package thinks it is built with -frtti. # For consistency we should set it to the correct value. set(LLVM_CONFIG_HAS_RTTI NO CACHE BOOL "" FORCE) ## Init # In case this was a path to a build folder of llvm still try to find AddLLVM list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") # Fix bug in some AddLLVM.cmake implementation (-rpath "" problem) set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) set( CPPINTEROP_BUILT_STANDALONE 1 ) include(AddLLVM) include(HandleLLVMOptions) endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) ``` -------------------------------- ### Initialize Project and LLVM Paths Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Sets up the project name and ensures LLVM, Clang, Cling, and LLD paths are correctly defined based on provided directory variables. ```cmake if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) project(CppInterOp) if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(WARNING "No build type selected. Defaulted CMAKE_BUILD_TYPE=Release.\n" "Valid options are: None, Debug, Release, RelWithDebInfo, MinSizeRel.") set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" FORCE) endif() # LLVM/Clang/Cling default paths if (DEFINED LLVM_DIR) if (NOT DEFINED Clang_DIR) set(Clang_DIR ${LLVM_DIR}) endif() if (NOT DEFINED Cling_DIR) set(Cling_DIR ${LLVM_DIR}) endif() if (NOT DEFINED LLD_DIR) set(LLD_DIR ${LLVM_DIR}) endif() endif() if (DEFINED LLD_DIR) if (NOT DEFINED LLVM_DIR) set(LLVM_DIR ${LLD_DIR}) endif() if (NOT DEFINED Clang_DIR) set(Clang_DIR ${LLD_DIR}) endif() if (NOT DEFINED Cling_DIR) set(Cling_DIR ${LLD_DIR}) endif() endif() if (DEFINED Clang_DIR) if (NOT DEFINED LLVM_DIR) set(LLVM_DIR ${Clang_DIR}) endif() if (NOT DEFINED LLD_DIR) set(LLD_DIR ${Clang_DIR}) endif() if (NOT DEFINED Cling_DIR) set(Cling_DIR ${Clang_DIR}) endif() endif() if (DEFINED Cling_DIR) if (NOT DEFINED LLVM_DIR) set(LLVM_DIR ${Cling_DIR}) endif() if (NOT DEFINED Clang_DIR) set(Clang_DIR ${Cling_DIR}) endif() endif() ``` -------------------------------- ### Create Build Directory Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Initialize the build directory for CppInterOp. ```bash mkdir CppInterOp/build/ cd CppInterOp/build/ ``` ```powershell mkdir CppInterOp\build\ cd CppInterOp\build\ ``` -------------------------------- ### Install Generated C++ Interop Headers Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Installs generated header files from the build directory. Excludes common build artifacts like 'CMakeFiles' and '*.inc' files. ```cmake install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION include FILES_MATCHING PATTERN "CMakeFiles" EXCLUDE PATTERN "*.inc" ) ``` -------------------------------- ### Serve Jupyter Lite with xeus-cpp Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Sets up the environment and launches the Jupyter Lite server with the xeus-cpp kernel and required notebook assets. ```bash cd ../.. micromamba create -n xeus-lite-host jupyterlite-core jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge micromamba activate xeus-lite-host jupyter lite serve --XeusAddon.prefix=$PREFIX \ --contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb \ --contents xeus-cpp/notebooks/tinyraytracer.ipynb \ --contents xeus-cpp/notebooks/images/marie.png \ --contents xeus-cpp/notebooks/audio/audio.wav \ --XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \ --XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" ``` ```powershell cd ..\.. micromamba create -n xeus-lite-host jupyterlite-core jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge micromamba activate xeus-lite-host jupyter lite serve --XeusAddon.prefix="$env:PREFIX" ` --contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb ` --contents xeus-cpp/notebooks/tinyraytracer.ipynb ` --contents xeus-cpp/notebooks/images/marie.png ` --contents xeus-cpp/notebooks/audio/audio.wav ` --XeusAddon.mounts="$env:PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" ` --XeusAddon.mounts="$env:PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" ``` -------------------------------- ### Install C++ Interop CMake Configuration Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Installs the generated CMake configuration files for C++ Interop. This allows other projects to find and use this package via CMake's find_package. ```cmake install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/CppInterOp/ DESTINATION lib/cmake/CppInterOp FILES_MATCHING PATTERN "*.cmake" ) ``` -------------------------------- ### Return to Build Directory Source: https://github.com/compiler-research/cppinterop/blob/main/docs/DevelopersDocumentation.md Navigate back to the top-level build directory. ```bash cd ../.. ``` -------------------------------- ### Build LLVM and Emscripten Tools Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Build the libclang, clangInterpreter, and clangStaticAnalyzerCore using emmake. ```powershell emmake ninja libclang clangInterpreter clangStaticAnalyzerCore ``` -------------------------------- ### Clone cppyy-backend Repository Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Clone the cppyy-backend repository, which is where the CppInterOp library will be installed. ```bash git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git ``` -------------------------------- ### Configure LLVM and Clang Dependencies Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Sets up include directories and definitions based on the selected REPL or Clang backend. ```cmake if(CPPINTEROP_USE_CLING) add_definitions(-DCPPINTEROP_USE_CLING) include_directories(SYSTEM ${CLING_INCLUDE_DIRS}) elseif(CPPINTEROP_USE_REPL) add_definitions(-DCPPINTEROP_USE_REPL) else() message(FATAL_ERROR "We need either CPPINTEROP_USE_CLING or CPPINTEROP_USE_REPL") endif() include_directories(SYSTEM ${CLANG_INCLUDE_DIRS}) include_directories(SYSTEM ${LLVM_INCLUDE_DIRS}) separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS}) add_definitions(${LLVM_DEFINITIONS_LIST}) string(REGEX REPLACE "/lib/cmake/llvm$" "" LLVM_BINARY_LIB_DIR "${LLVM_DIR}") add_definitions(-DLLVM_BINARY_LIB_DIR="${LLVM_BINARY_LIB_DIR}") ``` -------------------------------- ### Initialize Template Instantiation Variables Source: https://github.com/compiler-research/cppinterop/blob/main/docs/tutorials.md Sets up the initial declarations and arguments required for template lookup and instantiation. ```C Decl_t Instantiation = 0; const char * InstantiationArgs = "A"; Decl_t TemplatedClass = Clang_LookupName("B", /*Context=*/0); Decl_t T = 0; ``` -------------------------------- ### Build Cling and LLVM Dependencies Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Instructions for building the Cling interpreter and its customized LLVM project. ```bash git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git mkdir llvm-project/build cd llvm-project/build cmake -DLLVM_ENABLE_PROJECTS=clang \ -DLLVM_EXTERNAL_PROJECTS=cling \ -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \ -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ -DCLANG_ENABLE_ARCMT=OFF \ -DCLANG_ENABLE_FORMAT=OFF \ -DCLANG_ENABLE_BOOTSTRAP=OFF \ ../llvm cmake --build . --target clang --parallel $(nproc --all) cmake --build . --target cling --parallel $(nproc --all) ``` -------------------------------- ### Get Resource Directory Source: https://context7.com/compiler-research/cppinterop/llms.txt Retrieves the resource directory path used by CppInterOp, typically for headers. ```cpp // Get resource directory (for headers) const char* resourceDir = Cpp::GetResourceDir(); ``` -------------------------------- ### Configure Cling Include Paths Source: https://github.com/compiler-research/cppinterop/blob/main/docs/DevelopersDocumentation.md Environment variable configuration for building against cling. ```bash export CLING_DIR="$(pwd)/cling" export CLING_BUILD_DIR="$(pwd)/cling/build" export CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include" ``` ```powershell $env:CLING_DIR="$env:PWD_DIR\cling" $env:CLING_BUILD_DIR="$env:PWD_DIR\cling\build" $env:CPLUS_INCLUDE_PATH="$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;" ``` -------------------------------- ### Build CppInterOp with Cling Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Configure and build CppInterOp using Cling. ```bash cmake -DBUILD_SHARED_LIBS=ON -DCPPINTEROP_USE_CLING=ON -DCPPINTEROP_USE_REPL=Off -DCling_DIR=$LLVM_DIR/build/tools/cling -DLLVM_DIR=$LLVM_DIR/build/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/build/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. cmake --build . --target install --parallel $(nproc --all) ``` ```powershell cmake -DCPPINTEROP_USE_CLING=ON -DCPPINTEROP_USE_REPL=Off -DCling_DIR=$env:LLVM_DIR\build\tools\cling -DLLVM_DIR=$env:LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$env:LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR .. cmake --build . --target install --parallel $env:ncpus ``` -------------------------------- ### Build cppyy-backend Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Compile the backend and prepare library files. ```bash cd cppyy-backend mkdir -p python/cppyy_backend/lib build cd build cmake -DCppInterOp_DIR=$CPPINTEROP_DIR .. cmake --build . ``` -------------------------------- ### Activate Virtual Environment and Verify cppyy Source: https://github.com/compiler-research/cppinterop/blob/main/README.md Commands to activate the Python virtual environment and verify the cppyy installation. ```bash source .venv/bin/activate ``` ```bash python -c "import cppyy" ``` -------------------------------- ### Download and Expand Google Chrome on macOS Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Installs Google Chrome on macOS using wget and pkgutil for use in testing. ```bash wget https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg pkgutil --expand-full googlechrome.pkg google-chrome cd ./google-chrome/GoogleChrome.pkg/Payload/Google\ Chrome.app/Contents/MacOS/ export PATH="$PWD:$PATH" cd - ``` -------------------------------- ### Create Debug-Ready Test Program Source: https://github.com/compiler-research/cppinterop/blob/main/docs/DebuggingCppInterOp.md A sample C++ program demonstrating interpreter initialization with debug flags and dynamic code declaration. ```cpp #include #include void run_code(std::string code) { Cpp::Declare(code.c_str()); } int main(int argc, char *argv[]) { Cpp::CreateInterpreter({-gdwarf-4, -O0}); std::vector Decls; std::string code = R"( #include void f1() { std::cout << "in f1 function" << std::endl; } std::cout << "In codeblock 1" << std::endl; int a = 100; int b = 1000; )"; run_code(code); code = R"( f1(); )"; run_code(code); return 0; } ``` -------------------------------- ### Configure Clang-REPL Include Paths Source: https://github.com/compiler-research/cppinterop/blob/main/docs/DevelopersDocumentation.md Environment variable configuration for building against clang-repl. ```bash export CPLUS_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_DIR}/build/include:${LLVM_DIR}/build/tools/clang/include" ``` ```powershell $env:CPLUS_INCLUDE_PATH="$env:CPLUS_INCLUDE_PATH;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_DIR\build\include;$env:LLVM_DIR\build\tools\clang\include" ``` -------------------------------- ### Demangle C++ Symbols Source: https://context7.com/compiler-research/cppinterop/llms.txt Converts a mangled C++ symbol name into a human-readable form. Example output: "MyClass::method()". ```cpp // Demangle C++ symbols std::string mangled = "_ZN7MyClass6methodEv"; std::string demangled = Cpp::Demangle(mangled); // e.g., "MyClass::method()" ``` -------------------------------- ### Navigate Directories Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Return to the top-level directory. ```bash cd ../.. ``` ```powershell cd ..\.. ``` -------------------------------- ### Build CppInterOp with Clang-REPL Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Configure and build CppInterOp using Clang-REPL. ```bash cmake -DBUILD_SHARED_LIBS=ON -DLLVM_DIR=$LLVM_DIR/build/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/build/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. cmake --build . --target install --parallel $(nproc --all) ``` ```powershell cmake -DLLVM_DIR=$env:LLVM_DIR\build\lib\cmake\llvm -DClang_DIR=$env:LLVM_DIR\build\lib\cmake\clang -DCMAKE_INSTALL_PREFIX=$env:CPPINTEROP_DIR .. cmake --build . --target install --parallel $env:ncpus ``` -------------------------------- ### Configure CppInterOp CMake project Source: https://github.com/compiler-research/cppinterop/blob/main/CMakeLists.txt Sets up the build environment, including module paths, C++ language standards, and project-specific options for backend selection. ```cmake cmake_minimum_required(VERSION 3.13) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ) enable_language(CXX) set(CMAKE_CXX_EXTENSIONS NO) option(CPPINTEROP_USE_CLING "Use Cling as backend" OFF) option(CPPINTEROP_USE_REPL "Use clang-repl as backend" ON) option(CPPINTEROP_ENABLE_TESTING "Enable the CppInterOp testing infrastructure." ON) if(EMSCRIPTEN) set(CPPINTEROP_EXTRA_WASM_FLAGS "-fwasm-exceptions" CACHE STRING "Extra flags for wasm") endif() if (CPPINTEROP_USE_CLING AND CPPINTEROP_USE_REPL) message(FATAL_ERROR "We can only use Cling (${CPPINTEROP_USE_CLING}=On) or Repl (CPPINTEROP_USE_REPL=On), but not both of them.") endif() ``` -------------------------------- ### Build Clang-REPL on Windows Source: https://github.com/compiler-research/cppinterop/blob/main/docs/InstallationAndUsage.md Configure and build Clang-REPL using PowerShell on Windows. ```powershell $env:ncpus = $([Environment]::ProcessorCount) mkdir build cd build cmake -DLLVM_ENABLE_PROJECTS=clang ` -DLLVM_TARGETS_TO_BUILD="host;NVPTX" ` -DCMAKE_BUILD_TYPE=Release ` -DLLVM_ENABLE_ASSERTIONS=ON ` -DCLANG_ENABLE_STATIC_ANALYZER=OFF ` -DCLANG_ENABLE_ARCMT=OFF ` -DCLANG_ENABLE_FORMAT=OFF ` -DCLANG_ENABLE_BOOTSTRAP=OFF ` ..\llvm cmake --build . --target clang clang-repl --parallel $env:ncpus ``` -------------------------------- ### Build LLVM and CppInterOp Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Compile the native tools and the Wasm build of LLVM/Clang. ```bash mkdir native_build cd native_build cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release ../llvm/ cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all) export NATIVE_DIR=$PWD/bin/ cd .. mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=Release \ -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten \ -DLLVM_TARGETS_TO_BUILD="WebAssembly" \ -DLLVM_ENABLE_LIBEDIT=OFF \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_ENABLE_ZSTD=OFF \ -DLLVM_ENABLE_LIBXML2=OFF \ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ -DCLANG_ENABLE_ARCMT=OFF \ -DCLANG_ENABLE_BOOTSTRAP=OFF \ -DCMAKE_CXX_FLAGS="-Dwait4=__syscall_wait4" \ -DLLVM_INCLUDE_BENCHMARKS=OFF \ -DLLVM_INCLUDE_EXAMPLES=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_ENABLE_THREADS=OFF \ -DLLVM_BUILD_TOOLS=OFF \ -DLLVM_ENABLE_LIBPFM=OFF \ -DCLANG_BUILD_TOOLS=OFF \ -DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \ -DLLVM_ENABLE_LTO=Full \ ../llvm EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions" emmake make libclang clangInterpreter clangStaticAnalyzerCore -j $(nproc --all) ``` ```powershell mkdir native_build cd native_build cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm/ cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all) $env:PWD_DIR= $PWD.Path $env:NATIVE_DIR="$env:PWD_DIR/bin/" cd .. mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=Release ` -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten ` -DLLVM_TARGETS_TO_BUILD="WebAssembly" ` -DLLVM_ENABLE_LIBEDIT=OFF ` -DLLVM_ENABLE_PROJECTS="clang;lld" ` -DLLVM_ENABLE_ZSTD=OFF ` -DLLVM_ENABLE_LIBXML2=OFF ` -DCLANG_ENABLE_STATIC_ANALYZER=OFF ` -DCLANG_ENABLE_ARCMT=OFF ` -DCLANG_ENABLE_BOOTSTRAP=OFF ` -DCMAKE_CXX_FLAGS="-Dwait4=__syscall_wait4" ` -DLLVM_INCLUDE_BENCHMARKS=OFF ` ``` -------------------------------- ### Run Tests in Firefox and Chromium (Windows x86) Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Execute C++ interoperability tests in Firefox and Chromium on Windows x86 using emrun.bat. Assumes browsers are installed and in PATH. ```powershell echo "Running CppInterOpTests in Firefox" emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Firefox" emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html echo "Running CppInterOpTests in Chromium" emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Chromium" emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html ``` -------------------------------- ### Inspect C++ Enum Constants Source: https://context7.com/compiler-research/cppinterop/llms.txt Retrieve enum scopes, check if a scope is an enum, and get enum constants and their values. Useful for runtime analysis and manipulation of enum types. ```cpp #include "CppInterOp/CppInterOp.h" #include Cpp::CreateInterpreter(); Cpp::Declare(R"( enum Color { Red = 0, Green = 1, Blue = 2 }; enum class Priority : int { Low = 10, Medium = 20, High = 30 }; class Container { public: enum Status { Active, Inactive, Pending }; }; )"); // Get enum scope Cpp::TCppScope_t colorEnum = Cpp::GetNamed("Color"); Cpp::TCppScope_t priorityEnum = Cpp::GetNamed("Priority"); // Check if it's an enum bool isEnum = Cpp::IsEnumScope(colorEnum); // true // Get underlying integer type Cpp::TCppType_t underlyingType = Cpp::GetIntegerTypeFromEnumScope(colorEnum); std::string typeStr = Cpp::GetTypeAsString(underlyingType); // Get all enum constants std::vector constants = Cpp::GetEnumConstants(colorEnum); for (auto constant : constants) { std::string name = Cpp::GetName(constant); Cpp::TCppIndex_t value = Cpp::GetEnumConstantValue(constant); bool isEnumConstant = Cpp::IsEnumConstant(constant); // true Cpp::TCppType_t constType = Cpp::GetEnumConstantType(constant); } // Get enums within a class Cpp::TCppScope_t container = Cpp::GetScope("Container"); std::vector enumNames; Cpp::GetEnums(container, enumNames); // Contains "Status" // Get enum constants as data members std::vector enumDataMembers; Cpp::GetEnumConstantDatamembers(container, enumDataMembers, /*include_enum_class=*/true); ``` -------------------------------- ### Build LLVM for WebAssembly Source: https://github.com/compiler-research/cppinterop/blob/main/Emscripten-build-instructions.md Configuring and building LLVM with emscripten support. ```bash mkdir native_build cd native_build cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release ../llvm/ cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all) export NATIVE_DIR=$PWD/bin/ cd .. mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=Release \ -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten \ -DLLVM_TARGETS_TO_BUILD="WebAssembly" \ -DLLVM_ENABLE_LIBEDIT=OFF \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_ENABLE_ZSTD=OFF \ -DLLVM_ENABLE_LIBXML2=OFF \ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ -DCLANG_ENABLE_ARCMT=OFF \ -DCLANG_ENABLE_BOOTSTRAP=OFF \ -DCMAKE_CXX_FLAGS="-Dwait4=__syscall_wait4" \ -DLLVM_INCLUDE_BENCHMARKS=OFF \ -DLLVM_INCLUDE_EXAMPLES=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_ENABLE_THREADS=OFF \ -DLLVM_BUILD_TOOLS=OFF \ -DLLVM_ENABLE_LIBPFM=OFF \ -DCLANG_BUILD_TOOLS=OFF \ -DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \ -DLLVM_ENABLE_LTO=Full \ ../llvm EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions" emmake make libclang clangInterpreter clangStaticAnalyzerCore -j $(nproc --all) ``` ```powershell mkdir native_build cd native_build cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm/ cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all) $env:PWD_DIR= $PWD.Path $env:NATIVE_DIR="$env:PWD_DIR/bin/" cd .. mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=Release ` -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten ` -DLLVM_TARGETS_TO_BUILD="WebAssembly" ` -DLLVM_ENABLE_LIBEDIT=OFF ` -DLLVM_ENABLE_PROJECTS="clang;lld" ` -DLLVM_ENABLE_ZSTD=OFF ` -DLLVM_ENABLE_LIBXML2=OFF ` -DCLANG_ENABLE_STATIC_ANALYZER=OFF ` ``` -------------------------------- ### Cppyy Template Instantiation Example Source: https://github.com/compiler-research/cppinterop/blob/main/docs/UsingCppInterOp.md Demonstrates how to use cppyy to include a C++ header, instantiate a C++ template class with different types (int and float), and call its methods from a Python interpreter. ```Python >>> import cppyy >>> cppyy.include("Tmpl.h") >>> tmpl = Tmpl[int]() >>> tmpl.m_num = 4 >>> print(tmpl.add(5)) 9 >>> tmpl = Tmpl[float]() >>> tmpl.m_num = 3.0 >>> print(tmpl.add(4.0)) 7.0 ``` -------------------------------- ### Configure and Build CppInterOp (Linux/macOS) Source: https://github.com/compiler-research/cppinterop/blob/main/docs/Emscripten-build-instructions.md Configure the CppInterOp build using CMake with Emscripten toolchain and build the project. BUILD_SHARED_LIBS=ON is optional and needed for xeus-cpp. ```bash mkdir build cd ./build/ emcmake cmake -DCMAKE_BUILD_TYPE=Release \ -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \ -DLLD_DIR=$LLVM_BUILD_DIR/lib/cmake/lld \ -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DSYSROOT_PATH=$SYSROOT_PATH \ ../ emmake make -j $(nproc --all) check-cppinterop ``` -------------------------------- ### Get C++ Class Data Members Source: https://context7.com/compiler-research/cppinterop/llms.txt Retrieve instance, static, and enum members of a C++ class. Use GetDatamembers for all members, or GetStaticDatamembers for static members only. LookupDatamember can find specific members by name. ```cpp #include "CppInterOp/CppInterOp.h" #include Cpp::CreateInterpreter(); Cpp::Declare(R"( class DataClass { public: int publicInt; static const double PI; enum Status { Active, Inactive }; private: std::string privateStr; protected: float protectedFloat; }; const double DataClass::PI = 3.14159; )"); Cpp::TCppScope_t dataClass = Cpp::GetScope("DataClass"); // Get instance data members std::vector members; Cpp::GetDatamembers(dataClass, members); for (auto member : members) { std::string name = Cpp::GetName(member); Cpp::TCppType_t type = Cpp::GetVariableType(member); std::string typeStr = Cpp::GetTypeAsString(type); bool isPublic = Cpp::IsPublicVariable(member); bool isPrivate = Cpp::IsPrivateVariable(member); bool isProtected = Cpp::IsProtectedVariable(member); bool isStatic = Cpp::IsStaticVariable(member); bool isConst = Cpp::IsConstVariable(member); // Get offset for non-static members intptr_t offset = Cpp::GetVariableOffset(member); } // Get static data members only std::vector staticMembers; Cpp::GetStaticDatamembers(dataClass, staticMembers); // Lookup specific member Cpp::TCppScope_t publicInt = Cpp::LookupDatamember("publicInt", dataClass); ```