Marked with dllexport/import API functions

This commit is contained in:
Snaipe 2015-09-06 00:17:03 +02:00
parent 5d119c607e
commit 45fc694639
8 changed files with 43 additions and 16 deletions

View file

@ -30,6 +30,7 @@ set(GettextTranslate_ALL 1)
set(GettextTranslate_GMO_BINARY 1)
set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS ON)
add_definitions(-DCRITERION_BUILDING_DLL=1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu99")

View file

@ -26,6 +26,6 @@
# include "common.h"
NORETURN void criterion_abort_test(void);
CR_API NORETURN void criterion_abort_test(void);
#endif /* !CRITERION_ABORT_H_ */

View file

@ -111,4 +111,29 @@
# define FORMAT(Archetype, Index, Ftc)
# endif
# if defined _WIN32 || defined __CYGWIN__
# ifdef CRITERION_BUILDING_DLL
# ifdef __GNUC__
# define CR_API __attribute__ ((dllexport))
# else
# define CR_API __declspec(dllexport)
# endif
# else
# ifdef __GNUC__
# define CR_API __attribute__ ((dllimport))
# else
# define CR_API __declspec(dllimport)
# endif
# endif
# define CR_LOCAL
# else
# if __GNUC__ >= 4
# define CR_API __attribute__ ((visibility ("default")))
# define CR_LOCAL __attribute__ ((visibility ("hidden")))
# else
# define CR_API
# define CR_LOCAL
# endif
# endif
#endif /* !CRITERION_COMMON_H_ */

View file

@ -67,6 +67,6 @@
.data = &SUITE_IDENTIFIER_(Name, extra), \
} SECTION_SUFFIX_
int criterion_run_all_tests(void);
CR_API int criterion_run_all_tests(void);
#endif /* !CRITERION_H_ */

View file

@ -26,9 +26,10 @@
# include <stddef.h>
# include <stdio.h>
# include "common.h"
extern FILE *g_event_pipe;
void send_event(int kind, void *data, size_t size);
CR_API void send_event(int kind, void *data, size_t size);
#endif /* !CRITERION_EVENT_H_ */

View file

@ -76,13 +76,13 @@ extern const struct criterion_prefix_data g_criterion_logging_prefixes[];
# define CRITERION_PREFIX_PASS (&g_criterion_logging_prefixes[CRITERION_LOGGING_PREFIX_PASS ])
# define CRITERION_PREFIX_FAIL (&g_criterion_logging_prefixes[CRITERION_LOGGING_PREFIX_FAIL ])
void criterion_vlog(enum criterion_logging_level level, const char *msg, va_list args);
CR_API void criterion_vlog(enum criterion_logging_level level, const char *msg, va_list args);
FORMAT(printf, 3, 4)
void criterion_plog(enum criterion_logging_level level, const struct criterion_prefix_data *prefix, const char *msg, ...);
CR_API void criterion_plog(enum criterion_logging_level level, const struct criterion_prefix_data *prefix, const char *msg, ...);
FORMAT(printf, 2, 3)
void criterion_log(enum criterion_logging_level level, const char *msg, ...);
CR_API void criterion_log(enum criterion_logging_level level, const char *msg, ...);
# define criterion_info(...) criterion_log(CRITERION_INFO, __VA_ARGS__)
# define criterion_important(...) criterion_log(CRITERION_IMPORTANT, __VA_ARGS__)

View file

@ -50,10 +50,10 @@ struct criterion_test_set {
size_t tests;
};
struct criterion_ordered_set *new_ordered_set(f_criterion_cmp cmp,
CR_API struct criterion_ordered_set *new_ordered_set(f_criterion_cmp cmp,
void (*dtor)(void *, void *));
void *insert_ordered_set(struct criterion_ordered_set *l,
CR_API void *insert_ordered_set(struct criterion_ordered_set *l,
void *ptr,
size_t size);

View file

@ -29,14 +29,14 @@
struct criterion_theory_context;
struct criterion_theory_context* cr_theory_init(void);
void cr_theory_push_arg(struct criterion_theory_context *ctx, bool is_float, size_t size, void *ptr);
void cr_theory_free(struct criterion_theory_context *ctx);
void cr_theory_abort(void);
int cr_theory_mark(void);
CR_API struct criterion_theory_context* cr_theory_init(void);
CR_API void cr_theory_push_arg(struct criterion_theory_context *ctx, bool is_float, size_t size, void *ptr);
CR_API void cr_theory_free(struct criterion_theory_context *ctx);
CR_API void cr_theory_abort(void);
CR_API int cr_theory_mark(void);
void cr_theory_reset(struct criterion_theory_context *ctx);
void cr_theory_call(struct criterion_theory_context *ctx, void (*fnptr)(void));
CR_API void cr_theory_reset(struct criterion_theory_context *ctx);
CR_API void cr_theory_call(struct criterion_theory_context *ctx, void (*fnptr)(void));
# define TheoryDataPoints(Category, Name) \
static struct criterion_datapoints IDENTIFIER_(Category, Name, dps)[]
@ -64,7 +64,7 @@ struct criterion_datapoints {
cr_theory_abort(); \
} while (0);
void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*fnptr)(void));
CR_API void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*fnptr)(void));
# define CR_VAARG_ID(Suffix, Category, Name, ...) \
IDENTIFIER_(Category, Name, Suffix)