stardis

Perform coupled heat transfer calculations
git clone git://git.meso-star.fr/stardis.git
Log | Files | Refs | README | LICENSE

commit f04fe1b848ec4d3ea9b5340dd922b75a4964e30a
parent 8140d97bfdb8f26588b699c303b4ab564316b66b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 21 Feb 2024 11:35:02 +0100

Update the public header of programmable properties

Exports symbols using the C style linkage even if the library that
implements the expected functions is compiled in C++.

Make explicit the visibility of the exported symbols, i.e.  the
functions must be public. Note that there is no standard way to do this:
it is dependent on the compiler. So we define the STARTIS_API macro that
encapsulates the keywords used to make API functions public.

Diffstat:
Msrc/stardis-prog-properties.h.in | 113++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
1 file changed, 63 insertions(+), 50 deletions(-)

diff --git a/src/stardis-prog-properties.h.in b/src/stardis-prog-properties.h.in @@ -26,6 +26,12 @@ #include <stddef.h> +#if defined(__GNUC__) + #define STARDIS_API extern __attribute__((visibility("default"))) +#else + #define STARDIS_API extern +#endif + /*****************************************************************************/ /* API types. */ /* The various functions defining programmed descriptions receive arguments */ @@ -73,6 +79,10 @@ struct stardis_description_create_context { const char* name; /* Description name */ }; +#ifdef __cplusplus +extern "C" { +#endif + /******************************************************************************/ /* Optional functions for any programmed library. */ /* Either all 3 or none of the 3 following functions must be defined. */ @@ -85,7 +95,7 @@ struct stardis_description_create_context { * processed. * argc + argv describe the (possibly zero) arguments coming from the stardis * input file in the main-like standard way. */ -extern void* +STARDIS_API void* stardis_create_library_data (const struct stardis_program_context* ctx, size_t argc, @@ -98,7 +108,7 @@ stardis_create_library_data * starts. * lib_data is the pointer returned by stardis_create_library_data for this * library. */ -enum stardis_return_status +STARDIS_API enum stardis_return_status stardis_finalize_library_data (void* lib_data); @@ -107,7 +117,7 @@ stardis_finalize_library_data * descriptions data. * lib_data is the pointer returned by stardis_create_library_data for this * library. */ -extern void +STARDIS_API void stardis_release_library_data (void* lib_data); @@ -123,7 +133,7 @@ stardis_release_library_data * library or NULL if stardis_create_library_data is not defined. * argc + argv describe the (possibly zero) arguments coming from the stardis * input file in the main-like standard way. */ -extern void* +STARDIS_API void* stardis_create_data (const struct stardis_description_create_context *ctx, void* lib_data, @@ -133,28 +143,28 @@ stardis_create_data /* Release the data created by stardis_create_data. * This function is called after the simulation finished. * data is the pointer returned by stardis_create_data for the description. */ -extern void +STARDIS_API void stardis_release_data (void* data); /* Get the copyright notice. * A NULL result is interpreted as an error and ends the program. * data is the pointer returned by stardis_create_data for the description. */ -const char* +STARDIS_API const char* get_copyright_notice (void* data); /* Get single-line (name and link?) version of the license. * A NULL result is interpreted as an error and ends the program. * data is the pointer returned by stardis_create_data for the description. */ -const char* +STARDIS_API const char* get_license_short (void* data); /* Get full license text. * A NULL result is interpreted as an error and ends the program. * data is the pointer returned by stardis_create_data for the description. */ -const char* +STARDIS_API const char* get_license_text (void* data); @@ -172,7 +182,7 @@ get_license_text * This functions is called at every vertex of every path of the computation * crossing this solid. * data is the pointer returned by stardis_create_data for this solid. */ -extern double +STARDIS_API double stardis_calorific_capacity (const struct stardis_vertex* vtx, void* data); @@ -181,7 +191,7 @@ stardis_calorific_capacity * This functions is called at every vertex of every path of the computation * crossing this solid. * data is the pointer returned by stardis_create_data for this solid. */ -extern double +STARDIS_API double stardis_volumic_mass (const struct stardis_vertex* vtx, void* data); @@ -190,7 +200,7 @@ stardis_volumic_mass * This functions is called at every vertex of every path of the computation * crossing this solid. * data is the pointer returned by stardis_create_data for this solid. */ -extern double +STARDIS_API double stardis_conductivity (const struct stardis_vertex* vtx, void* data); @@ -199,7 +209,7 @@ stardis_conductivity * This functions is called at every vertex of every path of the computation * crossing this solid. * data is the pointer returned by stardis_create_data for this solid. */ -extern double +STARDIS_API double stardis_delta_solid (const struct stardis_vertex* vtx, void* data); @@ -208,7 +218,7 @@ stardis_delta_solid * This functions is called at every vertex of every path of the computation * crossing this solid. * data is the pointer returned by stardis_create_data for this solid. */ -extern double +STARDIS_API double stardis_volumic_power (const struct stardis_vertex* vtx, void* data); @@ -218,7 +228,7 @@ stardis_volumic_power * This functions is called at every vertex of every path of the computation * crossing this solid. * data is the pointer returned by stardis_create_data for this solid. */ -extern double +STARDIS_API double stardis_medium_temperature (const struct stardis_vertex* vtx, void* data); @@ -227,7 +237,7 @@ stardis_medium_temperature * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this solid. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); @@ -240,7 +250,7 @@ stardis_t_range * This functions is called at every vertex of every path of the computation * crossing this fluid. * data is the pointer returned by stardis_create_data for this fluid. */ -extern double +STARDIS_API double stardis_calorific_capacity (const struct stardis_vertex* vtx, void* data); @@ -249,7 +259,7 @@ stardis_calorific_capacity * This functions is called at every vertex of every path of the computation * crossing this fluid. * data is the pointer returned by stardis_create_data for this fluid. */ -extern double +STARDIS_API double stardis_volumic_mass (const struct stardis_vertex* vtx, void* data); @@ -259,7 +269,7 @@ stardis_volumic_mass * This functions is called at every vertex of every path of the computation * crossing this fluid. * data is the pointer returned by stardis_create_data for this fluid. */ -extern double +STARDIS_API double stardis_medium_temperature (const struct stardis_vertex* vtx, void* data); @@ -268,7 +278,7 @@ stardis_medium_temperature * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this fluid. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); @@ -281,7 +291,7 @@ stardis_t_range * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_boundary_temperature (const struct stardis_interface_fragment* frag, void* data); @@ -290,7 +300,7 @@ stardis_boundary_temperature * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_emissivity (const struct stardis_interface_fragment* frag, void* data); @@ -299,7 +309,7 @@ stardis_emissivity * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_specular_fraction (const struct stardis_interface_fragment* frag, void* data); @@ -308,7 +318,7 @@ stardis_specular_fraction * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_convection_coefficient (const struct stardis_interface_fragment* frag, void* data); @@ -319,7 +329,7 @@ stardis_convection_coefficient * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_reference_temperature (const struct stardis_interface_fragment* frag, void* data); @@ -327,7 +337,7 @@ stardis_reference_temperature /* Returns the upper bound of the convection coefficient accross this boundary. * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_max_convection_coefficient (void* data); @@ -335,7 +345,7 @@ stardis_max_convection_coefficient * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); @@ -348,7 +358,7 @@ stardis_t_range * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_emissivity (const struct stardis_interface_fragment* frag, void* data); @@ -357,7 +367,7 @@ stardis_emissivity * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_specular_fraction (const struct stardis_interface_fragment* frag, void* data); @@ -366,7 +376,7 @@ stardis_specular_fraction * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_convection_coefficient (const struct stardis_interface_fragment* frag, void* data); @@ -377,7 +387,7 @@ stardis_convection_coefficient * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_reference_temperature (const struct stardis_interface_fragment* frag, void* data); @@ -388,7 +398,7 @@ stardis_reference_temperature * This functions is called at every vertex of every path of the computation * crossing this fluid. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_medium_temperature (const struct stardis_vertex* vtx, void* data); @@ -396,7 +406,7 @@ stardis_medium_temperature /* Returns the upper bound of the convection coefficient accross this boundary. * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_max_convection_coefficient (void* data); @@ -404,7 +414,7 @@ stardis_max_convection_coefficient * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); @@ -417,7 +427,7 @@ stardis_t_range * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_boundary_temperature (const struct stardis_interface_fragment* frag, void* data); @@ -426,7 +436,7 @@ stardis_boundary_temperature * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); @@ -439,7 +449,7 @@ stardis_t_range * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_emissivity (const struct stardis_interface_fragment* frag, void* data); @@ -448,7 +458,7 @@ stardis_emissivity * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_specular_fraction (const struct stardis_interface_fragment* frag, void* data); @@ -457,7 +467,7 @@ stardis_specular_fraction * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_convection_coefficient (const struct stardis_interface_fragment* frag, void* data); @@ -466,7 +476,7 @@ stardis_convection_coefficient * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_boundary_flux (const struct stardis_interface_fragment* frag, void* data); @@ -477,7 +487,7 @@ stardis_boundary_flux * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_reference_temperature (const struct stardis_interface_fragment* frag, void* data); @@ -488,7 +498,7 @@ stardis_reference_temperature * This functions is called at every vertex of every path of the computation * crossing this fluid. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_medium_temperature (const struct stardis_vertex* vtx, void* data); @@ -496,7 +506,7 @@ stardis_medium_temperature /* Returns the upper bound of the convection coefficient accross this boundary. * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_max_convection_coefficient (void* data); @@ -504,7 +514,7 @@ stardis_max_convection_coefficient * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this boundary. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); @@ -517,7 +527,7 @@ stardis_t_range * This functions is called every time a path of the computation reaches * this boundary. * data is the pointer returned by stardis_create_data for this boundary. */ -extern double +STARDIS_API double stardis_boundary_flux (const struct stardis_interface_fragment* frag, void* data); @@ -530,7 +540,7 @@ stardis_boundary_flux * This functions is called every time a path of the computation reaches * this connection. * data is the pointer returned by stardis_create_data for this connection. */ -extern double +STARDIS_API double stardis_thermal_contact_resistance (const struct stardis_interface_fragment* frag, void* data); @@ -543,7 +553,7 @@ stardis_thermal_contact_resistance * This functions is called every time a path of the computation reaches * this connection. * data is the pointer returned by stardis_create_data for this connection. */ -extern double +STARDIS_API double stardis_emissivity (const struct stardis_interface_fragment* frag, void* data); @@ -552,7 +562,7 @@ stardis_emissivity * This functions is called every time a path of the computation reaches * this connection. * data is the pointer returned by stardis_create_data for this connection. */ -extern double +STARDIS_API double stardis_specular_fraction (const struct stardis_interface_fragment* frag, void* data); @@ -561,7 +571,7 @@ stardis_specular_fraction * This functions is called every time a path of the computation reaches * this connection. * data is the pointer returned by stardis_create_data for this connection. */ -extern double +STARDIS_API double stardis_convection_coefficient (const struct stardis_interface_fragment* frag, void* data); @@ -569,7 +579,7 @@ stardis_convection_coefficient /* Returns the upper bound of the convection coefficient accross this connection. * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this connection. */ -extern double +STARDIS_API double stardis_max_convection_coefficient (void* data); @@ -577,10 +587,13 @@ stardis_max_convection_coefficient * This functions is called once when initializing the computation. * data is the pointer returned by stardis_create_data for this connection. * Returns its modified range argument. */ -extern double* +STARDIS_API double* stardis_t_range (void* data, double range[2]); +#ifdef __cplusplus +} /* extern "C" */ #endif +#endif