Ruby  3.1.4p223 (2023-03-30 revision HEAD)
dllexport.h
Go to the documentation of this file.
1 #ifndef RBIMPL_DLLEXPORT_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_DLLEXPORT_H
23 #include "ruby/internal/config.h"
25 
39 #undef RUBY_EXTERN
40 #if defined(MJIT_HEADER) && defined(_WIN32)
41 # define RUBY_EXTERN extern __declspec(dllimport)
42 #elif defined(RUBY_EXPORT)
43 # define RUBY_EXTERN extern
44 #elif defined(_WIN32)
45 # define RUBY_EXTERN extern __declspec(dllimport)
46 #else
47 # define RUBY_EXTERN extern
48 #endif
49 
50 #ifndef RUBY_SYMBOL_EXPORT_BEGIN
51 # define RUBY_SYMBOL_EXPORT_BEGIN /* begin */
52 #endif
53 
54 #ifndef RUBY_SYMBOL_EXPORT_END
55 # define RUBY_SYMBOL_EXPORT_END /* end */
56 #endif
57 
58 #ifndef RUBY_FUNC_EXPORTED
59 # define RUBY_FUNC_EXPORTED /* void */
60 #endif
61 
69 /* These macros are used for functions which are exported only for MJIT
70  and NOT ensured to be exported in future versions. */
71 
72 #if ! defined(MJIT_HEADER)
73 # define MJIT_FUNC_EXPORTED RUBY_FUNC_EXPORTED
74 #elif ! RBIMPL_COMPILER_IS(MSVC)
75 # define MJIT_FUNC_EXPORTED RUBY_FUNC_EXPORTED
76 #else
77 # define MJIT_FUNC_EXPORTED static
78 #endif
79 
80 #define MJIT_SYMBOL_EXPORT_BEGIN RUBY_SYMBOL_EXPORT_BEGIN
81 #define MJIT_SYMBOL_EXPORT_END RUBY_SYMBOL_EXPORT_END
82 
83 /* On mswin, MJIT header transformation can't be used since cl.exe can't output
84  preprocessed output preserving macros. So this `MJIT_STATIC` is needed
85  to force non-static function to static on MJIT header to avoid symbol conflict. */
86 #ifdef MJIT_HEADER
87 # define MJIT_STATIC static
88 #else
89 # define MJIT_STATIC
90 #endif
91 
96 #if defined(__DOXYGEN__)
97 # define RBIMPL_SYMBOL_EXPORT_BEGIN() /* void */
98 #elif defined(__cplusplus)
99 # define RBIMPL_SYMBOL_EXPORT_BEGIN() RUBY_SYMBOL_EXPORT_BEGIN extern "C" {
100 #else
101 # define RBIMPL_SYMBOL_EXPORT_BEGIN() RUBY_SYMBOL_EXPORT_BEGIN
102 #endif
103 
105 #if defined(__DOXYGEN__)
106 # define RBIMPL_SYMBOL_EXPORT_END() /* void */
107 #elif defined(__cplusplus)
108 # define RBIMPL_SYMBOL_EXPORT_END() } RUBY_SYMBOL_EXPORT_END
109 #else
110 # define RBIMPL_SYMBOL_EXPORT_END() RUBY_SYMBOL_EXPORT_END
111 #endif
112 #endif /* RBIMPL_DLLEXPORT_H */
Defines RBIMPL_COMPILER_IS.