Skip to content

Commit

Permalink
use some windows api
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes committed Jan 14, 2025
1 parent 9910489 commit 8b2a8a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void main() async {

const optimizationLevels = OptimizationLevel.values;
var selectOptimizationLevel = 0;
var selectBuildMode = 0;

final dumpbinFileType = {
DynamicLoadingBundled(): 'DLL',
Expand All @@ -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 =
Expand Down Expand Up @@ -112,7 +115,7 @@ void main() async {
assetName: name,
sources: [addCUri.toFilePath()],
optimizationLevel: optimizationLevel,
buildMode: BuildMode.release,
buildMode: buildMode,
);
await cbuilder.run(
input: buildInput,
Expand Down
7 changes: 7 additions & 0 deletions pkgs/native_toolchain_c/test/cbuilder/testfiles/add/src/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#ifdef DEBUG
#include <stdio.h>

#if _WIN32
#include <wchar.h>
#endif
#endif

#if _WIN32
Expand All @@ -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;
}

0 comments on commit 8b2a8a7

Please sign in to comment.