Astaroth
3.1
Scalable Multi-GPU Stencil Computations
Loading...
Searching...
No Matches
func_define.h
Go to the documentation of this file.
1
#ifndef __FUNC_DEFINE_ALREADY_INCLUDED__
2
#define __FUNC_DEFINE_ALREADY_INCLUDED__
3
4
#include <stdio.h>
5
#include <stdlib.h>
6
7
#ifdef __cplusplus
8
9
#define AC_BEGIN_C_DECLARATIONS extern "C" {
10
#define AC_END_C_DECLARATIONS }
11
12
#else
13
14
#define AC_BEGIN_C_DECLARATIONS
15
#define AC_END_C_DECLARATIONS
16
17
#endif
18
19
#if AC_RUNTIME_COMPILATION
20
21
static
void
22
ac_library_not_yet_loaded()
23
{
24
fprintf(stderr,
25
"This function needs Astaroth to be loaded via acLoadLibrary before calling it!\n"
);
26
abort();
27
}
28
29
#if __cplusplus
30
#define BASE_FUNC_NAME(func_name) func_name##_BASE
31
#else
32
#define BASE_FUNC_NAME(func_name) func_name
33
#endif
34
35
#else
36
37
#define BASE_FUNC_NAME(func_name) func_name
38
39
#endif
/* AC_RUNTIME_COMPILATION */
40
41
#endif
/* __FUNC_DEFINE_ALREADY_INCLUDED__ */
42
43
#undef FUNC_DEFINE
44
#undef OVERLOADED_FUNC_DEFINE
45
46
#if AC_RUNTIME_COMPILATION
47
48
#ifdef __FUNC_DEFINE_MAIN_STORAGE__
49
50
#ifdef __cplusplus
51
#define FUNC_DEFINE(return_type, func_name, ...) return_type (*func_name) __VA_ARGS__ = (return_type (*) __VA_ARGS__ ) ac_library_not_yet_loaded
52
#else
53
#define FUNC_DEFINE(return_type, func_name, ...) extern return_type (*func_name) __VA_ARGS__
54
#endif
55
56
#define OVERLOADED_FUNC_DEFINE(return_type, func_name, ...) return_type (*BASE_FUNC_NAME(func_name)) __VA_ARGS__ = (return_type (*) __VA_ARGS__ ) ac_library_not_yet_loaded
57
58
#else
59
60
#define FUNC_DEFINE(return_type, func_name, ...) extern return_type (*func_name) __VA_ARGS__
61
62
#define OVERLOADED_FUNC_DEFINE(return_type, func_name, ...) extern return_type (*BASE_FUNC_NAME(func_name)) __VA_ARGS__
63
64
#endif
65
66
#else
67
68
#ifndef FUNC_DEFINE
69
#define FUNC_DEFINE(return_type, func_name, ...) return_type func_name __VA_ARGS__
70
#endif
71
72
#ifndef OVERLOADED_FUNC_DEFINE
73
#define OVERLOADED_FUNC_DEFINE FUNC_DEFINE
74
#endif
75
76
#endif
include
func_define.h
Generated by
1.15.0