From 8b2a8a7c52a075ef7f98e922fdf086ecf7b086f2 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 14 Jan 2025 06:07:32 -0800 Subject: [PATCH] use some windows api --- .../test/cbuilder/cbuilder_cross_windows_host_test.dart | 7 +++++-- .../test/cbuilder/testfiles/add/src/add.c | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart index 459dde38d..01aeb6203 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart @@ -60,6 +60,7 @@ void main() async { const optimizationLevels = OptimizationLevel.values; var selectOptimizationLevel = 0; + var selectBuildMode = 0; final dumpbinFileType = { DynamicLoadingBundled(): 'DLL', @@ -73,9 +74,11 @@ void main() async { final optimizationLevel = optimizationLevels[selectOptimizationLevel]; selectOptimizationLevel = (selectOptimizationLevel + 1) % optimizationLevels.length; + final buildMode = BuildMode.values[selectBuildMode]; + selectBuildMode = (selectBuildMode + 1) % BuildMode.values.length; test( 'CBuilder ${compiler.name} $linkMode library $target' - ' $optimizationLevel', () async { + ' $optimizationLevel $buildMode', () async { final tempUri = await tempDirForTest(); final tempUri2 = await tempDirForTest(); final addCUri = @@ -112,7 +115,7 @@ void main() async { assetName: name, sources: [addCUri.toFilePath()], optimizationLevel: optimizationLevel, - buildMode: BuildMode.release, + buildMode: buildMode, ); await cbuilder.run( input: buildInput, diff --git a/pkgs/native_toolchain_c/test/cbuilder/testfiles/add/src/add.c b/pkgs/native_toolchain_c/test/cbuilder/testfiles/add/src/add.c index 6a16ccab6..3c0fab5f1 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/testfiles/add/src/add.c +++ b/pkgs/native_toolchain_c/test/cbuilder/testfiles/add/src/add.c @@ -6,6 +6,10 @@ #ifdef DEBUG #include + +#if _WIN32 +#include +#endif #endif #if _WIN32 @@ -17,6 +21,9 @@ FFI_EXPORT int32_t add(int32_t a, int32_t b) { #ifdef DEBUG printf("Adding %i and %i.\n", a, b); +#if _WIN32 + wprintf("Adding %i and %i.\n", a, b); +#endif #endif return a + b; }