Ruby 3.5.0dev (2025-01-10 revision 5fab31b15e32622c4b71d1d347a41937e9f9c212)
abi.h
1#ifndef RUBY_ABI_H
2#define RUBY_ABI_H
3
4#ifdef RUBY_ABI_VERSION /* should match the definition in config.h */
5
6/* This number represents Ruby's ABI version.
7 *
8 * In development Ruby, it should be bumped every time an ABI incompatible
9 * change is introduced. This will force other developers to rebuild extension
10 * gems.
11 *
12 * The following cases are considered as ABI incompatible changes:
13 * - Changing any data structures.
14 * - Changing macros or inline functions causing a change in behavior.
15 * - Deprecating or removing function declarations.
16 *
17 * The following cases are NOT considered as ABI incompatible changes:
18 * - Any changes that does not involve the header files in the `include`
19 * directory.
20 * - Adding macros, inline functions, or function declarations.
21 * - Backwards compatible refactors.
22 * - Editing comments.
23 *
24 * In released versions of Ruby, this number is not defined since teeny
25 * versions of Ruby should guarantee ABI compatibility.
26 */
27#define RUBY_ABI_VERSION 0
28
29/* Windows does not support weak symbols so ruby_abi_version will not exist
30 * in the shared library. */
31#if defined(HAVE_FUNC_WEAK) && !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
32# define RUBY_DLN_CHECK_ABI
33#endif
34#endif /* RUBY_ABI_VERSION */
35
36#if defined(RUBY_DLN_CHECK_ABI) && !defined(RUBY_EXPORT)
37
38# ifdef __cplusplus
39extern "C" {
40# endif
41
42RUBY_FUNC_EXPORTED unsigned long long __attribute__((weak))
43ruby_abi_version(void)
44{
45# ifdef RUBY_ABI_VERSION
46 return RUBY_ABI_VERSION;
47# else
48 return 0;
49# endif
50}
51
52# ifdef __cplusplus
53}
54# endif
55
56#endif
57
58#endif