htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit 913a784ac94ad8e7a9c4ab54eed87e83052185e0
parent 07834d535efbf4c9a0f4d70e16438167f16711d4
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 31 Oct 2023 14:59:09 +0100

Partially link static library object files

Make hidden symbols local to the relocatable object to avoid conflicts
with internal symbols in another static library. In release mode, delete
all symbols not required for relocation processing, but keep them in
debug mode for.

Replace the HTRDR_CORE_API macro with the HTRDR_API macro. The former
was used by the core library, while the latter is intended for internal
libraries. The core library can be compiled as a shared or static
library, while internal libraries are static only. But in fact, both
static and shared libraries can be compiled using the same compilation
flags and definitions. In fact, this is what is done so that hidden
symbols are local to the static library. The HTRDR_CORE_API macro is
unnecessary and is therefore removed.

Diffstat:
MMakefile | 80++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mconfig.mk | 6++++++
Msrc/core/htrdr.h | 37++++++++++++++-----------------------
Msrc/core/htrdr_args.h.in | 18+++++++++---------
Msrc/core/htrdr_buffer.h | 12++++++------
Msrc/core/htrdr_draw_map.h | 2+-
Msrc/core/htrdr_geometry.h | 18+++++++++---------
Msrc/core/htrdr_log.h | 6+++---
Msrc/core/htrdr_materials.h | 10+++++-----
Msrc/core/htrdr_ran_wlen_cie_xyz.h | 12++++++------
Msrc/core/htrdr_ran_wlen_discrete.h | 8++++----
Msrc/core/htrdr_ran_wlen_planck.h | 8++++----
Msrc/core/htrdr_rectangle.h | 18+++++++++---------
Msrc/core/htrdr_slab.h | 2+-
Msrc/core/htrdr_spectral.h | 4++--
15 files changed, 124 insertions(+), 117 deletions(-)

diff --git a/Makefile b/Makefile @@ -26,6 +26,10 @@ include config.mk +ATMOSPHERE_LIBNAME = libhtrdr-atmosphere.a +COMBUSTION_LIBNAME = libhtrdr-combustion.a +PLANETO_LIBNAME = libhtrdr-planeto.a + PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./:$${PKG_CONFIG_PATH}" $(PKG_CONFIG) # Define macros when ATMOSPHERE is set to ENABLE @@ -33,21 +37,21 @@ ATMOSPHERE_CFLAGS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --cflags htrdr-atmosp ATMOSPHERE_LIBS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --libs htrdr-atmosphere) ATMOSPHERE_BUILD_LIB_ENABLE = build_atmosphere ATMOSPHERE_BUILD_CMD_ENABLE = build_htrdr_atmosphere -ATMOSPHERE_LIBNAME_ENABLE = libhtrdr-atmosphere.a +ATMOSPHERE_LIBNAME_ENABLE = $(ATMOSPHERE_LIBNAME) # Define macros when COMBUSTION is set to ENABLE COMBUSTION_CFLAGS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --cflags htrdr-combustion) COMBUSTION_LIBS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --libs htrdr-combustion) COMBUSTION_BUILD_LIB_ENABLE = build_combustion COMBUSTION_BUILD_CMD_ENABLE = build_htrdr_combustion -COMBUSTION_LIBNAME_ENABLE = libhtrdr-combustion.a +COMBUSTION_LIBNAME_ENABLE = $(COMBUSTION_LIBNAME) # Define macros when PLANETO is set to ENABLE PLANETO_CFLAGS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --cflags htrdr-planeto) PLANETO_LIBS_ENABLE = $$($(PKG_CONFIG_LOCAL) --static --libs htrdr-planeto) PLANETO_BUILD_LIB_ENABLE = build_planeto PLANETO_BUILD_CMD_ENABLE = build_htrdr_planeto -PLANETO_LIBNAME_ENABLE = libhtrdr-planeto.a +PLANETO_LIBNAME_ENABLE = $(PLANETO_LIBNAME) # Default target all:\ @@ -63,7 +67,6 @@ all:\ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi @echo "config done" > $@ - # Inference rules for command build .SUFFIXES: .c .d .o .c.d: @@ -215,10 +218,6 @@ CORE_LIBNAME_STATIC = libhtrdr-core.a CORE_LIBNAME_SHARED = libhtrdr-core.so CORE_LIBNAME = $(CORE_LIBNAME_$(LIB_TYPE)) -CORE_CFLAGS_SHARED = $(CFLAGS_SO) -CORE_CFLAGS_STATIC = $(CFLAGS_EXE) -CORE_CFLAGS = $(CORE_CFLAGS_$(LIB_TYPE)) - CORE_SRC =\ src/core/htrdr.c\ src/core/htrdr_args.c\ @@ -247,12 +246,16 @@ build_core: .config_core htrdr-core.pc $(CORE_DEP) $(CORE_DEP) $(CORE_OBJ): config.mk src/core/htrdr_args.h src/core/htrdr_version.h $(CORE_LIBNAME_SHARED): $(CORE_OBJ) - $(CC) $(CORE_CFLAGS) $(CORE_DPDC_CFLAGS) -o $@ $(CORE_OBJ) $(LDFLAGS_SO) $(CORE_DPDC_LIBS) + $(CC) $(CFLAGS_SO) $(CORE_DPDC_CFLAGS) -o $@ $(CORE_OBJ) $(LDFLAGS_SO) $(CORE_DPDC_LIBS) -$(CORE_LIBNAME_STATIC): $(CORE_OBJ) +$(CORE_LIBNAME_STATIC): libhtrdr-core.o $(AR) -rc $@ $? $(RANLIB) $@ +libhtrdr-core.o: $(CORE_OBJ) + $(LD) -r $(CORE_OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + .config_core: config.mk @if ! $(PKG_CONFIG) --atleast-version $(AW_VERSION) aw; then \ echo "aw $(AW_VERSION) not found" >&2; exit 1; fi @@ -298,10 +301,10 @@ src/core/htrdr_version.h: config.mk src/core/htrdr_version.h.in $@.in > $@ $(CORE_DEP): - @$(CC) $(CORE_CFLAGS) $(CORE_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + @$(CC) $(CFLAGS_SO) $(CORE_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ $(CORE_OBJ): - $(CC) $(CORE_CFLAGS) $(CORE_DPDC_CFLAGS) -Isrc -DHTRDR_CORE_SHARED_BUILD -c $(@:.o=.c) -o $@ + $(CC) $(CFLAGS_SO) $(CORE_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@ htrdr-core.pc: config.mk htrdr-core.pc.in sed -e 's/@VERSION@/$(VERSION)/g' \ @@ -317,9 +320,9 @@ htrdr-core.pc: config.mk htrdr-core.pc.in $@.in > $@ clean_core: - rm -f $(CORE_OBJ) $(CORE_LIBNAME) - rm -f .config_core src/core/htrdr_args.h src/core/htrdr_version.h - rm -f htrdr-core.pc + rm -f $(CORE_OBJ) $(CORE_LIBNAME) libhtrdr-core.o + rm -f .config_core mobhtrdr-core.o htrdr-core.pc + rm -f src/core/htrdr_args.h src/core/htrdr_version.h distclean_core: clean_core rm -f $(CORE_DEP) @@ -327,8 +330,6 @@ distclean_core: clean_core ################################################################################ # Building the atmosphere library ################################################################################ -ATMOSPHERE_LIBNAME = libhtrdr-atmosphere.a - ATMOSPHERE_SRC =\ src/atmosphere/htrdr_atmosphere_args.c\ src/atmosphere/htrdr_atmosphere.c\ @@ -347,10 +348,14 @@ build_atmosphere: build_core .config_atmosphere htrdr-atmosphere.pc $(ATMOSPHERE $(ATMOSPHERE_DEP) $(ATMOSPHERE_OBJ): config.mk src/atmosphere/htrdr_atmosphere_args.h -$(ATMOSPHERE_LIBNAME): $(ATMOSPHERE_OBJ) +$(ATMOSPHERE_LIBNAME): libhtrdr-atmosphere.o $(AR) -rc $@ $? $(RANLIB) $@ +libhtrdr-atmosphere.o: $(ATMOSPHERE_OBJ) + $(LD) -r $(ATMOSPHERE_OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + .config_atmosphere: config.mk @if ! $(PKG_CONFIG) --atleast-version $(HTSKY_VERSION) htsky; then \ echo "htsky $(HTSKY_VERSION) not found" >&2; exit 1; fi @@ -374,10 +379,10 @@ src/atmosphere/htrdr_atmosphere_args.h: config.mk src/atmosphere/htrdr_atmospher $@.in > $@ $(ATMOSPHERE_DEP): - @$(CC) $(CFLAGS_EXE) $(ATMOSPHERE_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + @$(CC) $(CFLAGS_SO) $(ATMOSPHERE_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ $(ATMOSPHERE_OBJ): - $(CC) $(CFLAGS_EXE) $(ATMOSPHERE_DPDC_CFLAGS) -Isrc -DHTRDR_STATIC -c $(@:.o=.c) -o $@ + $(CC) $(CFLAGS_SO) $(ATMOSPHERE_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@ htrdr-atmosphere.pc: config.mk htrdr-atmosphere.pc.in sed -e 's/@VERSION@/$(VERSION)/g' \ @@ -392,8 +397,8 @@ htrdr-atmosphere.pc: config.mk htrdr-atmosphere.pc.in clean_atmosphere: rm -f $(ATMOSPHERE_OBJ) $(ATMOSPHERE_LIBNAME) - rm -f .config_atmosphere src/atmosphere/htrdr_atmosphere_args.h - rm -f htrdr-atmosphere.pc + rm -f .config_atmosphere libhtrdr-atmosphere.o htrdr-atmosphere.pc + rm -f src/atmosphere/htrdr_atmosphere_args.h distclean_atmosphere: clean_atmosphere rm -f $(ATMOSPHERE_DEP) @@ -401,8 +406,6 @@ distclean_atmosphere: clean_atmosphere ################################################################################ # Building the combustion library ################################################################################ -COMBUSTION_LIBNAME = libhtrdr-combustion.a - COMBUSTION_SRC =\ src/combustion/htrdr_combustion.c\ src/combustion/htrdr_combustion_args.c\ @@ -421,10 +424,14 @@ build_combustion: build_core .config_combustion htrdr-combustion.pc $(COMBUSTION $(COMBUSTION_DEP) $(COMBUSTION_OBJ): config.mk src/combustion/htrdr_combustion_args.h -$(COMBUSTION_LIBNAME): $(COMBUSTION_OBJ) +$(COMBUSTION_LIBNAME): libhtrdr-combustion.o $(AR) -rc $@ $? $(RANLIB) $@ +libhtrdr-combustion.o: $(COMBUSTION_OBJ) + $(LD) -r $(COMBUSTION_OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + .config_combustion: config.mk @if ! $(PKG_CONFIG) --atleast-version $(ATRSTM_VERSION) atrstm; then \ echo "atrstm $(ATRSTM_VERSION) not found" >&2; exit 1; fi @@ -452,11 +459,10 @@ src/combustion/htrdr_combustion_args.h: config.mk src/combustion/htrdr_combustio $@.in > $@ $(COMBUSTION_DEP): - @$(CC) $(CFLAGS_EXE) $(COMBUSTION_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + @$(CC) $(CFLAGS_SO) $(COMBUSTION_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ $(COMBUSTION_OBJ): - $(CC) $(CFLAGS_EXE) $(COMBUSTION_DPDC_CFLAGS) -Isrc -DHTRDR_STATIC -c $(@:.o=.c) -o $@ - + $(CC) $(CFLAGS_SO) $(COMBUSTION_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@ htrdr-combustion.pc: config.mk htrdr-combustion.pc.in sed -e 's/@VERSION@/$(VERSION)/g' \ @@ -471,8 +477,8 @@ htrdr-combustion.pc: config.mk htrdr-combustion.pc.in clean_combustion: rm -f $(COMBUSTION_OBJ) $(COMBUSTION_LIBNAME) - rm -f .config_combustion src/combustion/htrdr_combustion_args.h - rm -f htrdr-combustion.pc + rm -f .config_combustion libhtrdr-combustion.o htrdr-combustion.pc + rm -f src/combustion/htrdr_combustion_args.h distclean_combustion: clean_combustion rm -f $(COMBUSTION_DEP) @@ -498,10 +504,14 @@ build_planeto: build_core .config_planeto htrdr-planeto.pc $(PLANETO_DEP) $(PLANETO_DEP) $(PLANETO_OBJ): config.mk src/planeto/htrdr_planeto_args.h -$(PLANETO_LIBNAME): $(PLANETO_OBJ) +$(PLANETO_LIBNAME): libhtrdr-planeto.o $(AR) -rc $@ $? $(RANLIB) $@ +libhtrdr-planeto.o: $(PLANETO_OBJ) + $(LD) -r $(PLANETO_OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + .config_planeto: config.mk @if ! $(PKG_CONFIG) --atleast-version $(RNATM_VERSION) rnatm; then \ echo "rnatm $(RNATM_VERSION) not found" >&2; exit 1; fi @@ -529,10 +539,10 @@ src/planeto/htrdr_planeto_args.h: config.mk src/planeto/htrdr_planeto_args.h.in $@.in > $@ $(PLANETO_DEP): - @$(CC) $(CFLAGS_EXE) $(PLANETO_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + @$(CC) $(CFLAGS_SO) $(PLANETO_DPDC_CFLAGS) -Isrc -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ $(PLANETO_OBJ): - $(CC) $(CFLAGS_EXE) $(PLANETO_DPDC_CFLAGS) -Isrc -DHTRDR_STATIC -c $(@:.o=.c) -o $@ + $(CC) $(CFLAGS_SO) $(PLANETO_DPDC_CFLAGS) -Isrc -DHTRDR_SHARED_BUILD -c $(@:.o=.c) -o $@ htrdr-planeto.pc: config.mk htrdr-planeto.pc.in sed -e 's/@VERSION@/$(VERSION)/g' \ @@ -549,8 +559,8 @@ htrdr-planeto.pc: config.mk htrdr-planeto.pc.in clean_planeto: rm -f $(PLANETO_OBJ) $(PLANETO_LIBNAME) - rm -f .config_planeto src/planeto/htrdr_planeto_args.h - rm -f htrdr-planeto.pc + rm -f .config_planeto libhtrdr-planeto.o htrdr-planeto.pc + rm -f src/planeto/htrdr_planeto_args.h distclean_planeto: clean_planeto rm -f $(PLANETO_DEP) diff --git a/config.mk b/config.mk @@ -63,6 +63,8 @@ HTRDR_PLANETO_ARGS_DEFAULT_GRID_DEFINITION_HINT = 512 ################################################################################ AR = ar CC = cc +LD = ld +OBJCOPY = objcopy PKG_CONFIG = pkg-config RANLIB = ranlib @@ -254,3 +256,7 @@ LDFLAGS_RELEASE = -s $(LDFLAGS_HARDENED) LDFLAGS_SO = $(LDFLAGS_$(BUILD_TYPE)) -shared -Wl,--no-undefined LDFLAGS_EXE = $(LDFLAGS_$(BUILD_TYPE)) -pie + +OCPFLAGS_DEBUG = --localize-hidden +OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded +OCPFLAGS = $(OCPFLAGS_$(BUILD_TYPE)) diff --git a/src/core/htrdr.h b/src/core/htrdr.h @@ -27,15 +27,6 @@ #include <rsys/rsys.h> #include <stdio.h> -/* Library symbol management */ -#if defined(HTRDR_CORE_SHARED_BUILD) /* Build shared library */ - #define HTRDR_CORE_API extern EXPORT_SYM -#elif defined(HTRDR_CORE_STATIC) /* Use/build static library */ - #define HTRDR_CORE_API extern LOCAL_SYM -#else /* Use shared library */ - #define HTRDR_CORE_API extern IMPORT_SYM -#endif - #if defined(HTRDR_SHARED_BUILD) /* Build shared library */ #define HTRDR_API extern EXPORT_SYM #elif defined(HTRDR_STATIC) /* Use/build static library */ @@ -97,69 +88,69 @@ BEGIN_DECLS /* Initialize the MPI execution environment. Must be called priorly to any MPI * invocation, e.g. at the beginning of the main function */ -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_mpi_init (int argc, char** argv); /* Terminate the MPI execution environment */ -HTRDR_CORE_API void +HTRDR_API void htrdr_mpi_finalize (void); /******************************************************************************* * HTRDR api ******************************************************************************/ -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_create (struct mem_allocator* allocator, const struct htrdr_args* args, struct htrdr** htrdr); -HTRDR_CORE_API void +HTRDR_API void htrdr_ref_get (struct htrdr* htrdr); -HTRDR_CORE_API void +HTRDR_API void htrdr_ref_put (struct htrdr* htrdr); /* Return the number of threads used by the process */ -HTRDR_CORE_API size_t +HTRDR_API size_t htrdr_get_threads_count (const struct htrdr* htrdr); /* Return the number of running processes for the current htrdr instance */ -HTRDR_CORE_API size_t +HTRDR_API size_t htrdr_get_procs_count (const struct htrdr* htrdr); -HTRDR_CORE_API int +HTRDR_API int htrdr_get_mpi_rank (const struct htrdr* htrdr); -HTRDR_CORE_API struct mem_allocator* +HTRDR_API struct mem_allocator* htrdr_get_allocator (struct htrdr* htrdr); -HTRDR_CORE_API struct mem_allocator* +HTRDR_API struct mem_allocator* htrdr_get_thread_allocator (struct htrdr* htrdr, const size_t ithread); -HTRDR_CORE_API struct logger* +HTRDR_API struct logger* htrdr_get_logger (struct htrdr* htrdr); -HTRDR_CORE_API int +HTRDR_API int htrdr_get_verbosity_level (const struct htrdr* htrdr); -HTRDR_CORE_API struct s3d_device* +HTRDR_API struct s3d_device* htrdr_get_s3d (struct htrdr* htrdr); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_open_output_stream (struct htrdr* htrdr, const char* filename, diff --git a/src/core/htrdr_args.h.in b/src/core/htrdr_args.h.in @@ -131,44 +131,44 @@ static const struct htrdr_args_spectral HTRDR_ARGS_SPECTRAL_DEFAULT = ******************************************************************************/ BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_camera_perspective_parse (struct htrdr_args_camera_perspective* cam, const char* str); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_camera_perspective_check (const struct htrdr_args_camera_perspective* cam); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_camera_orthographic_parse (struct htrdr_args_camera_orthographic* cam, const char* str); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_rectangle_parse (struct htrdr_args_rectangle* rect, const char* str); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_image_parse (struct htrdr_args_image* img, const char* str); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_image_check (const struct htrdr_args_image* img); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_spectral_parse (struct htrdr_args_spectral* spectral, const char* str); -HTRDR_CORE_API void +HTRDR_API void htrdr_args_geometry_free (struct htrdr_args_geometry* geom); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_args_geometry_parse (struct htrdr_args_geometry* geom, const char* str); diff --git a/src/core/htrdr_buffer.h b/src/core/htrdr_buffer.h @@ -82,30 +82,30 @@ struct htrdr_buffer; BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_buffer_create (struct htrdr* htrdr, const struct htrdr_buffer_layout* layout, struct htrdr_buffer** buf); -HTRDR_CORE_API void +HTRDR_API void htrdr_buffer_ref_get (struct htrdr_buffer* buf); -HTRDR_CORE_API void +HTRDR_API void htrdr_buffer_ref_put (struct htrdr_buffer* buf); -HTRDR_CORE_API void +HTRDR_API void htrdr_buffer_get_layout (const struct htrdr_buffer* buf, struct htrdr_buffer_layout* layout); -HTRDR_CORE_API void* +HTRDR_API void* htrdr_buffer_get_data (struct htrdr_buffer* buf); -HTRDR_CORE_API void* +HTRDR_API void* htrdr_buffer_at (struct htrdr_buffer* buf, const size_t x, diff --git a/src/core/htrdr_draw_map.h b/src/core/htrdr_draw_map.h @@ -86,7 +86,7 @@ htrdr_draw_pixel_args_check(const struct htrdr_draw_pixel_args* args) ******************************************************************************/ BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_draw_map (struct htrdr* htrdr, const struct htrdr_draw_map_args* args, diff --git a/src/core/htrdr_geometry.h b/src/core/htrdr_geometry.h @@ -58,47 +58,47 @@ HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL = HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL__; BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_geometry_create (struct htrdr* htrdr, const char* obj_filename, struct htrdr_materials* mats, /* Library of materials */ struct htrdr_geometry** geometry); -HTRDR_CORE_API void +HTRDR_API void htrdr_geometry_ref_get (struct htrdr_geometry* geom); -HTRDR_CORE_API void +HTRDR_API void htrdr_geometry_ref_put (struct htrdr_geometry* geom); -HTRDR_CORE_API void +HTRDR_API void htrdr_geometry_get_interface (struct htrdr_geometry* geom, const struct s3d_hit* hit, struct htrdr_interface* interface); -HTRDR_CORE_API void +HTRDR_API void htrdr_geometry_get_hit_position (const struct htrdr_geometry* geom, const struct s3d_hit* hit, double position[3]); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_geometry_trace_ray (struct htrdr_geometry* geom, const struct htrdr_geometry_trace_ray_args* args, struct s3d_hit* hit); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_geometry_find_closest_point (struct htrdr_geometry* geom, const double position[3], const double radius, struct s3d_hit* hit); -HTRDR_CORE_API void +HTRDR_API void htrdr_geometry_get_aabb (const struct htrdr_geometry* geom, double lower[3], @@ -106,7 +106,7 @@ htrdr_geometry_get_aabb /* Empirical value relative to the extent of the geometry that represents the * threshold below which a numerical problem could occur. */ -HTRDR_CORE_API double +HTRDR_API double htrdr_geometry_get_epsilon (const struct htrdr_geometry* geom); diff --git a/src/core/htrdr_log.h b/src/core/htrdr_log.h @@ -35,7 +35,7 @@ struct htrdr; BEGIN_DECLS -HTRDR_CORE_API void +HTRDR_API void htrdr_log (struct htrdr* htrdr, const char* msg, @@ -45,7 +45,7 @@ htrdr_log #endif ; -HTRDR_CORE_API void +HTRDR_API void htrdr_log_err (struct htrdr* htrdr, const char* msg, @@ -55,7 +55,7 @@ htrdr_log_err #endif ; -HTRDR_CORE_API void +HTRDR_API void htrdr_log_warn (struct htrdr* htrdr, const char* msg, diff --git a/src/core/htrdr_materials.h b/src/core/htrdr_materials.h @@ -44,28 +44,28 @@ static const struct htrdr_mtl HTRDR_MTL_NULL = HTRDR_MTL_NULL__; BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_materials_create (struct htrdr* htrdr, const char* filename, struct htrdr_materials** mats); -HTRDR_CORE_API void +HTRDR_API void htrdr_materials_ref_get (struct htrdr_materials* mats); -HTRDR_CORE_API void +HTRDR_API void htrdr_materials_ref_put (struct htrdr_materials* mats); /* Return 1 if the material exist and 0 otherwise */ -HTRDR_CORE_API int +HTRDR_API int htrdr_materials_find_mtl (struct htrdr_materials* mats, const char* mtl_name, struct htrdr_mtl* mtl); -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_mtl_create_bsdf (struct htrdr* htrdr, const struct htrdr_mtl* mtl, diff --git a/src/core/htrdr_ran_wlen_cie_xyz.h b/src/core/htrdr_ran_wlen_cie_xyz.h @@ -38,37 +38,37 @@ struct htrdr_ran_wlen_cie_xyz; BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_ran_wlen_cie_xyz_create (struct htrdr* htrdr, const double range[2], /* Must be included in [380, 780] nanometers */ const size_t nbands, /* # bands used to discretize the CIE tristimulus */ struct htrdr_ran_wlen_cie_xyz** cie); -HTRDR_CORE_API void +HTRDR_API void htrdr_ran_wlen_cie_xyz_ref_get (struct htrdr_ran_wlen_cie_xyz* cie); -HTRDR_CORE_API void +HTRDR_API void htrdr_ran_wlen_cie_xyz_ref_put (struct htrdr_ran_wlen_cie_xyz* cie); /* Return a wavelength in nanometer */ -HTRDR_CORE_API double +HTRDR_API double htrdr_ran_wlen_cie_xyz_sample_X (struct htrdr_ran_wlen_cie_xyz* cie, const double r0, const double r1, /* Canonical numbers in [0, 1[ */ double* pdf); /* In nm^-1. May be NULL */ /* Return a wavelength in nanometer */ -HTRDR_CORE_API double +HTRDR_API double htrdr_ran_wlen_cie_xyz_sample_Y (struct htrdr_ran_wlen_cie_xyz* cie, const double r0, const double r1, /* Canonical number in [0, 1[ */ double* pdf); /* In nm^-1. May be NULL */ /* Return a wavelength in nanometer */ -HTRDR_CORE_API double +HTRDR_API double htrdr_ran_wlen_cie_xyz_sample_Z (struct htrdr_ran_wlen_cie_xyz* cie, const double r0, const double r1, /* Canonical number in [0, 1[ */ diff --git a/src/core/htrdr_ran_wlen_discrete.h b/src/core/htrdr_ran_wlen_discrete.h @@ -47,21 +47,21 @@ struct htrdr_ran_wlen_discrete; BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_ran_wlen_discrete_create (struct htrdr* htrdr, const struct htrdr_ran_wlen_discrete_create_args* args, struct htrdr_ran_wlen_discrete** ran); -HTRDR_CORE_API void +HTRDR_API void htrdr_ran_wlen_discrete_ref_get (struct htrdr_ran_wlen_discrete* ran); -HTRDR_CORE_API void +HTRDR_API void htrdr_ran_wlen_discrete_ref_put (struct htrdr_ran_wlen_discrete* ran); -HTRDR_CORE_API double /* wavelength in nanometer */ +HTRDR_API double /* wavelength in nanometer */ htrdr_ran_wlen_discrete_sample (struct htrdr_ran_wlen_discrete* ran, const double r0, const double r1, /* Canonical number in [0, 1[ */ diff --git a/src/core/htrdr_ran_wlen_planck.h b/src/core/htrdr_ran_wlen_planck.h @@ -35,7 +35,7 @@ struct htrdr_ran_wlen_planck; BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_ran_wlen_planck_create (struct htrdr* htrdr, const double range[2], @@ -45,16 +45,16 @@ htrdr_ran_wlen_planck_create const double ref_temperature, /* Reference temperature */ struct htrdr_ran_wlen_planck** planck); -HTRDR_CORE_API void +HTRDR_API void htrdr_ran_wlen_planck_ref_get (struct htrdr_ran_wlen_planck* planck); -HTRDR_CORE_API void +HTRDR_API void htrdr_ran_wlen_planck_ref_put (struct htrdr_ran_wlen_planck* planck); /* Return a wavelength in nanometer */ -HTRDR_CORE_API double +HTRDR_API double htrdr_ran_wlen_planck_sample (const struct htrdr_ran_wlen_planck* planck, const double r0, /* Canonical number in [0, 1[ */ diff --git a/src/core/htrdr_rectangle.h b/src/core/htrdr_rectangle.h @@ -33,7 +33,7 @@ struct htrdr_rectangle; /* 2D rectangle transformed in 3D */ BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_rectangle_create (struct htrdr* htrdr, const double sz[2], /* Size of the rectangle along its local X and Y axis */ @@ -42,41 +42,41 @@ htrdr_rectangle_create const double up[3], /* vector orthogonal to the rectangle X axis */ struct htrdr_rectangle** rect); -HTRDR_CORE_API void +HTRDR_API void htrdr_rectangle_ref_get (struct htrdr_rectangle* rect); -HTRDR_CORE_API void +HTRDR_API void htrdr_rectangle_ref_put (struct htrdr_rectangle* rect); -HTRDR_CORE_API void +HTRDR_API void htrdr_rectangle_sample_pos (const struct htrdr_rectangle* rect, const double sample[2], /* In [0, 1[ */ double pos[3]); -HTRDR_CORE_API void +HTRDR_API void htrdr_rectangle_get_normal (const struct htrdr_rectangle* rect, double normal[3]); -HTRDR_CORE_API void +HTRDR_API void htrdr_rectangle_get_center (const struct htrdr_rectangle* rect, double center[3]); -HTRDR_CORE_API double* +HTRDR_API double* htrdr_rectangle_get_transform (const struct htrdr_rectangle* rect, double transform[12]); -HTRDR_CORE_API double* +HTRDR_API double* htrdr_rectangle_get_transform_inverse (const struct htrdr_rectangle* rect, double transform_inverse[12]); -HTRDR_CORE_API void +HTRDR_API void htrdr_rectangle_get_size (const struct htrdr_rectangle* rect, double size[2]); diff --git a/src/core/htrdr_slab.h b/src/core/htrdr_slab.h @@ -41,7 +41,7 @@ typedef res_T BEGIN_DECLS /* Trace a ray into a slab composed of a cell infinitely repeated in X and Y */ -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_slab_trace_ray (struct htrdr* htrdr, const double org[3], diff --git a/src/core/htrdr_spectral.h b/src/core/htrdr_spectral.h @@ -149,7 +149,7 @@ htrdr_planck BEGIN_DECLS -HTRDR_CORE_API res_T +HTRDR_API res_T htrdr_brightness_temperature (struct htrdr* htrdr, const double lambda_min, /* In meters */ @@ -158,7 +158,7 @@ htrdr_brightness_temperature const double radiance, double* temperature); -HTRDR_CORE_API double +HTRDR_API double htrdr_radiance_temperature (struct htrdr* htrdr, const double lambda_min, /* In meters */