git » sdk » commit 066d082

Enable full dce on C++ build

author Stephen Paul Weber
2025-05-12 13:20:10 UTC
committer Stephen Paul Weber
2025-05-12 13:36:16 UTC
parent 3cd91acb00fad72fa7518e4870cb872260604138

Enable full dce on C++ build

cpp.hxml +2 -0
snikket/jingle/PeerConnection.cpp.hx +5 -0

diff --git a/cpp.hxml b/cpp.hxml
index 5619ddc..128d046 100644
--- a/cpp.hxml
+++ b/cpp.hxml
@@ -1,3 +1,5 @@
+--dce full
+
 --library datetime
 --library haxe-strings
 --library hsluv
diff --git a/snikket/jingle/PeerConnection.cpp.hx b/snikket/jingle/PeerConnection.cpp.hx
index ccc5b43..3ef1cd3 100644
--- a/snikket/jingle/PeerConnection.cpp.hx
+++ b/snikket/jingle/PeerConnection.cpp.hx
@@ -810,6 +810,7 @@ class PeerConnection {
 		pc.ref.onGatheringStateChange(cast untyped __cpp__("[this](auto s) { this->onGatheringStateChange(s); }"));
 	}
 
+	@:keep
 	private function onLocalDescription() {
 		untyped __cpp__("int base = 0; hx::SetTopOfStack(&base, true);"); // allow running haxe code on foreign thread
 		mainLoop.run(() -> {
@@ -820,6 +821,7 @@ class PeerConnection {
 		untyped __cpp__("hx::SetTopOfStack((int*)0, true);"); // unregister with GC
 	}
 
+	@:keep
 	private function onLocalCandidate(candidate: Candidate) {
 		untyped __cpp__("int base = 0; hx::SetTopOfStack(&base, true);"); // allow running haxe code on foreign thread
 		mainLoop.run(() -> {
@@ -834,6 +836,7 @@ class PeerConnection {
 		untyped __cpp__("hx::SetTopOfStack((int*)0, true);"); // unregister with GC
 	}
 
+	@:keep
 	private function onStateChange(state: cpp.Struct<PCState>) {
 		untyped __cpp__("int base = 0; hx::SetTopOfStack(&base, true);"); // allow running haxe code on foreign thread
 		mainLoop.run(() -> {
@@ -844,6 +847,7 @@ class PeerConnection {
 		untyped __cpp__("hx::SetTopOfStack((int*)0, true);"); // unregister with GC
 	}
 
+	@:keep
 	private function onGatheringStateChange(state: cpp.Struct<GatheringState>) {
 		untyped __cpp__("int base = 0; hx::SetTopOfStack(&base, true);"); // allow running haxe code on foreign thread
 		final c: cpp.Struct<GatheringState> = Complete;
@@ -857,6 +861,7 @@ class PeerConnection {
 		untyped __cpp__("hx::SetTopOfStack((int*)0, true);"); // unregister with GC
 	}
 
+	@:keep
 	private function onTrack(track: SharedPtr<Track>) {
 		untyped __cpp__("int base = 0; hx::SetTopOfStack(&base, true);"); // allow running haxe code on foreign thread
 		mainLoop.run(() -> {