APIs, concepts, guides, and more
gcode-callback-registration
Warning
The following caveats apply to all callback registrations:
  • RapidCode does not take ownership of your callback. The GcodeCallback you register must be kept alive throughout all loading and execution of G-Code, or else behavior is undefined. Before your callback is destroyed, unregister it or delete the Robot.
  • In C#, a named local variable alone does not prevent garbage collection. Call GC.KeepAlive(callback) after the program is finished. Ensure that the GC.KeepAlive call cannot be skipped by an early return or thrown error (e.g., with a finally block) and that the program is no longer running (see Gcode::Cancel()).
  • Registering or unregistering a callback will require you to re-load your G-Code before any calls to Gcode::Run().