Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test to validate hostfxr C API #110169

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

am11
Copy link
Member

@am11 am11 commented Nov 26, 2024

Add a test for #109763 and align the style as headers in src/native/minipal/*.h.

@am11 am11 requested a review from elinor-fung November 26, 2024 00:45
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Nov 26, 2024
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@am11 am11 force-pushed the feature/corehost/c-api branch from 7aa4875 to 37fe3b5 Compare November 26, 2024 00:46
@am11
Copy link
Member Author

am11 commented Nov 26, 2024

e.g. without the struct keyword, it failed to build tests

  In file included from /Users/am11/projects/runtime5/src/native/corehost/test/mockhostfxr/test_c_api.c:8:
  /Users/am11/projects/runtime5/src/native/corehost/hostfxr.h:419:20: error: must use 'struct' tag to refer to type 'hostfxr_initialize_parameters'
    419 |     /*opt*/ const  hostfxr_initialize_parameters* parameters,
        |                    ^
        |                    struct 
  1 error generated.
  make[2]: *** [test/mockhostfxr/CMakeFiles/mockhostfxr_5_0.dir/test_c_api.c.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  [ 73%] Building CXX object fxr/standalone/CMakeFiles/hostfxr.dir/__/corehost_init.cpp.o
  make[1]: *** [test/mockhostfxr/CMakeFiles/mockhostfxr_5_0.dir/all] Error 2

@@ -322,6 +323,10 @@ struct hostfxr_dotnet_environment_info
const struct hostfxr_dotnet_environment_framework_info* frameworks;
};

typedef void(HOSTFXR_CALLTYPE* hostfxr_get_dotnet_environment_info_result_fn)(
const struct hostfxr_dotnet_environment_info* info,
void* result_context);
Copy link
Member Author

Choose a reason for hiding this comment

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

Had to move it after the struct hostfxr_dotnet_environment_framework_info is defined, to fix:

  In file included from /Users/am11/projects/runtime5/src/native/corehost/test/mockhostfxr/test_c_api.c:8:
  /Users/am11/projects/runtime5/src/native/corehost/hostfxr.h:91:18: error: declaration of 'struct hostfxr_dotnet_environment_info' will not be visible outside of this function [-Werror,-Wvisibility]
     91 |     const struct hostfxr_dotnet_environment_info* info,
        |                  ^
  1 error generated.
  make[2]: *** [test/mockhostfxr/CMakeFiles/mockhostfxr_2_2.dir/test_c_api.c.o] Error 1
  make[2]: *** Waiting for unfinished jobs....

@am11
Copy link
Member Author

am11 commented Nov 26, 2024

Backport together with #110060, since it fixes another ordering issue related to C vs. C++.

Copy link
Member

@elinor-fung elinor-fung left a comment

Choose a reason for hiding this comment

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

Thank you!

@elinor-fung elinor-fung merged commit 201b1b1 into dotnet:main Nov 26, 2024
147 checks passed
@am11 am11 deleted the feature/corehost/c-api branch November 26, 2024 22:26
mikelle-rogers pushed a commit to mikelle-rogers/runtime that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Host community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants