Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/native/corehost/coreclr_delegates.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#ifndef __CORECLR_DELEGATES_H__
#define __CORECLR_DELEGATES_H__
#ifndef HAVE_CORECLR_DELEGATES_H
#define HAVE_CORECLR_DELEGATES_H

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C"
{
#endif

#if defined(_WIN32)
#define CORECLR_DELEGATE_CALLTYPE __stdcall
#ifdef _WCHAR_T_DEFINED
Expand Down Expand Up @@ -57,4 +63,8 @@ typedef int (CORECLR_DELEGATE_CALLTYPE *load_assembly_bytes_fn)(
void *load_context /* Extensibility parameter (currently unused and must be 0) */,
void *reserved /* Extensibility parameter (currently unused and must be 0) */);

#endif // __CORECLR_DELEGATES_H__
#ifdef __cplusplus
}
#endif // __cplusplus

#endif // HAVE_CORECLR_DELEGATES_H
13 changes: 7 additions & 6 deletions src/native/corehost/nethost/nethost.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#ifndef __NETHOST_H__
#define __NETHOST_H__
#ifndef HAVE_NETHOST_H
#define HAVE_NETHOST_H

#include <stddef.h>

Expand Down Expand Up @@ -37,7 +37,8 @@
#endif

#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif

// Parameters for get_hostfxr_path
Expand Down Expand Up @@ -93,7 +94,7 @@ NETHOST_API int NETHOST_CALLTYPE get_hostfxr_path(
const struct get_hostfxr_parameters *parameters);

#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // __cplusplus

#endif // __NETHOST_H__
#endif // HAVE_NETHOST_H
12 changes: 7 additions & 5 deletions src/native/corehost/test/mockhostfxr/test_c_api.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// hostfxr.h is a public API. When included in .c files, it may fail to compile
// if C++-specific syntax is used within the extern "C" block. Since all usage of
// this API in runtime repo is within C++ code, such breakages are not encountered
// during normal development or testing.
#include "hostfxr.h"
// These headers provide access to the public hosting APIs. This file tests that
// they can be included in pure C code without causing compilation errors.
// Since the runtime repository primarily uses these APIs in C++ code, such issues
// might not be caught during regular development or testing.
#include <coreclr_delegates.h>
#include <hostfxr.h>
#include <nethost/nethost.h>
Loading