Skip to content

Conversation

@rabail-aamir
Copy link
Contributor

Description

This document provides an overview of how C++ support is implemented in Splashkit Online, including:

  • Where C++ related components live in the repository
  • Role of the CXXCompiler
  • How Web Workers and the Clang backend work
  • How C++ is compiled to WebAssembly (WASM)
  • How browser runtime executes compiled programs
  • How error handling works

It will help new contributors understand structured and flow of C++ backend and supports future improvement tasks.

Fixes # (issue)

Type of change

  • [ ✔] Documentation (update or new)

How Has This Been Tested?

This change affects documentation only.
No code functionality was modified.

Testing Checklist

  • [✔ ] Tested in latest Chrome
  • [ ✔] Tested in latest Safari
  • [ ✔] Tested in latest Firefox

Checklist

  • [✔ ] My code follows the style guidelines of this project
  • [ ✔] I have performed a self-review of my own code
  • [✔ ] I have commented my code in hard-to-understand areas
  • [✔ ] I have made corresponding changes to the documentation
  • [ ✔] My changes generate no new warnings
  • [ ✔] I have requested a review from ... on the Pull Request

Copy link

@stelaukin stelaukin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some suggestions about the phrasing of a few things and there are a couple of minor spelling and grammar issues.


## Introduction

This document gives overview of how in Splashkit Online, code is compiled and execuded. It describes how user-written C++ code flows from the browser editor to WebAssembly compilation and execution.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Change first sentence to This document gives an overview of how Splashkit Online compiles and executes code. to improve readability.
    -- Removes double space between is compiled
    -- Corrects spelling of executed


This document gives overview of how in Splashkit Online, code is compiled and execuded. It describes how user-written C++ code flows from the browser editor to WebAssembly compilation and execution.

Main purpse is to help new contributors understand that how the system integrates C++ capability without requiring in-depth compiler knowledge.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor spelling/grammar changes:
The main purpose is to help new contributors understand how the system integrates C++ capabilities without requiring in-depth compiler knowledge.

- Warn users about unsupported API usage

It communicates with Web Worker to make sure that main interface doesn't freeze during compilation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revises grammar/spellling:

The **CXXCompiler** class manages the C++ compilation process. Its responsibilities include:

- Writing source files to the virtual filesystem
- Compiling each C++ file into object files
- Linking object files into final WebAssembly output
- Providing syntax checking and error reporting
- Warning users about unsupported API usage

It communicates with a Web Worker to ensure the main interface doesn't freeze during compilation.

In a Web Worker, the actual compilation process is carried out using:

- **clang++.wasm** Compiles C++ source into object files
- **wasm-ld.wasm** Links object files into a final WASM executable

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either:

- **clang++.wasm**: Compiles C++ source into object files
- **wasm-ld.wasm**: Links object files into a final 

OR

- **clang++.wasm** compiles C++ source into object files
- **wasm-ld.wasm** links object files into a final 

- **clang++.wasm** Compiles C++ source into object files
- **wasm-ld.wasm** Links object files into a final WASM executable

In order to maintain UI responsiveness, this occurs asynchronously.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing:
This occurs asynchronously to maintain UI responsiveness.


- Sandboxing for security
- Compatibility between platforms
- Execution in real time in a web setting

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's WASM or Wasm or wasm.

Last bullet point could be reived to - Real-time execution in web environments


## Error Handling and Output

Prior to being displayed to the user, compiler messages undergo processing and formatting. In order to emphasise certain lines and offer insightful terminal feedback, errors are analysed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing:

During error handling, compiler messages are processed and formatted before being displayed to the user. 
This is done to ensure key lines are emphasised and clear terminal feedback is provided through error analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants