From 3fd0d3b7ac7753dae4ac6a73a79f7f032cb552cd Mon Sep 17 00:00:00 2001 From: Allan MacKinnon <allanmac@google.com> Date: Mon, 13 May 2019 21:16:07 +0000 Subject: [PATCH] [graphics][compute] Properly export C functions for use in C++ (HotSort) Tracked by SPN-19. Testability: HotSort library and test compile and run. Change-Id: I6a80c97057493c3f967cc4eef30691e82d18ad16 --- .../compute/hotsort/hotsort_gen/target_glsl.c | 16 ++++++++++++++++ .../compute/hotsort/platforms/vk/hotsort_vk.h | 16 ++++++++++++++++ .../hotsort/platforms/vk/hotsort_vk_target.h | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/src/graphics/lib/compute/hotsort/hotsort_gen/target_glsl.c b/src/graphics/lib/compute/hotsort/hotsort_gen/target_glsl.c index 3bc61a382d1..521c1a7172b 100644 --- a/src/graphics/lib/compute/hotsort/hotsort_gen/target_glsl.c +++ b/src/graphics/lib/compute/hotsort/hotsort_gen/target_glsl.c @@ -138,10 +138,26 @@ hsg_target_header_and_module(struct hsg_config const * const config) "// \n" "// \n" " \n" + "#ifdef __cplusplus \n" + "extern \"C\" { \n" + "#endif \n" + " \n" + "// \n" + "// \n" + "// \n" + " \n" "extern struct hotsort_vk_target const HS_TARGET_NAME; \n" " \n" "// \n" "// \n" + "// \n" + " \n" + "#ifdef __cplusplus \n" + "} \n" + "#endif \n" + " \n" + "// \n" + "// \n" "// \n", config->define.lower); diff --git a/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk.h b/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk.h index 81c1955d028..3c0524e6028 100644 --- a/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk.h +++ b/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk.h @@ -22,6 +22,14 @@ // // +#ifdef __cplusplus +extern "C" { +#endif + +// +// +// + #include "hotsort_vk_target.h" // @@ -151,3 +159,11 @@ hotsort_vk_sort(VkCommandBuffer cb, // // // + +#ifdef __cplusplus +} +#endif + +// +// +// diff --git a/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk_target.h b/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk_target.h index 38457d79bdc..23c06bf5de7 100644 --- a/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk_target.h +++ b/src/graphics/lib/compute/hotsort/platforms/vk/hotsort_vk_target.h @@ -10,6 +10,14 @@ #include <stdint.h> +// +// +// + +#ifdef __cplusplus +extern "C" { +#endif + // // This structure packages target-specific HotSort parameters and // SPIR-V modules. @@ -65,3 +73,11 @@ struct hotsort_vk_target // // // + +#ifdef __cplusplus +} +#endif + +// +// +// -- GitLab