Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
version.h File Reference

(892c46283a5ea4179500d951c9d4866c0051f27b)

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

The origin.

These information never change.

Just written here to remember.

#define RUBY_AUTHOR   "Yukihiro Matsumoto"
 Author of this project. More...
 
#define RUBY_BIRTH_YEAR   1993
 Ruby's birth year. More...
 
#define RUBY_BIRTH_MONTH   2
 Ruby's birth month. More...
 
#define RUBY_BIRTH_DAY   24
 Ruby's birth day. More...
 
The API version.

API version is different from binary version.

These numbers are for API stability. When you have distinct API versions x and y, you cannot expect codes targeted to x also works for y.

However let us repeat here that it's a BAD idea to check RUBY_API_VERSION_CODE form extension libraries. Different API versions are just different. There is no such thing like upper compatibility.

#define RUBY_API_VERSION_MAJOR   3
 Major version. More...
 
#define RUBY_API_VERSION_MINOR   4
 Minor version. More...
 
#define RUBY_API_VERSION_TEENY   0
 Teeny version. More...
 
#define RUBY_API_VERSION_CODE   (RUBY_API_VERSION_MAJOR*10000+RUBY_API_VERSION_MINOR*100+RUBY_API_VERSION_TEENY)
 This macro is API versions encoded into a C integer. More...
 

Variables

Interfaces from extension libraries.

Before using these infos, think thrice whether they are really necessary or not, and if the answer was yes, think twice a week later again.

const int ruby_api_version [3]
 API versions, in { major, minor, teeny } order. More...
 
const char ruby_version []
 Stringised version. More...
 
const char ruby_release_date []
 Date of release, in a C string. More...
 
const char ruby_platform []
 Target platform identifier, in a C string. More...
 
const int ruby_patchlevel
 This is a monotonic increasing integer that describes specific "patch" level. More...
 
const char ruby_description []
 This is what ruby -v prints to the standard error. More...
 
const char ruby_copyright []
 Copyright notice. More...
 
const char ruby_engine []
 This is just "ruby" for us. More...
 

Detailed Description

Author
$Author$
Date
Wed May 13 12:56:56 JST 2009

This file contains only

Never try to check RUBY_VERSION_CODE etc in extension libraries, check the features with mkmf.rb instead.

Definition in file version.h.

Macro Definition Documentation

◆ RUBY_API_VERSION_CODE

#define RUBY_API_VERSION_CODE   (RUBY_API_VERSION_MAJOR*10000+RUBY_API_VERSION_MINOR*100+RUBY_API_VERSION_TEENY)

This macro is API versions encoded into a C integer.

Note
Use mkmf.
Don't rely on it.

Definition at line 84 of file version.h.

◆ RUBY_API_VERSION_MAJOR

#define RUBY_API_VERSION_MAJOR   3

Major version.

This digit changes sometimes for various reasons, but that doesn't mean a total rewrite. Practically when it comes to API versioning, major and minor version changes are equally catastrophic.

Definition at line 64 of file version.h.

◆ RUBY_API_VERSION_MINOR

#define RUBY_API_VERSION_MINOR   4

Minor version.

As of writing this version changes annually. Greater version doesn't mean "better"; they just mean years passed.

Definition at line 70 of file version.h.

◆ RUBY_API_VERSION_TEENY

#define RUBY_API_VERSION_TEENY   0

Teeny version.

This digit is kind of reserved these days. Kept 0 for the entire 2.x era. Waiting for future uses.

Definition at line 76 of file version.h.

◆ RUBY_AUTHOR

#define RUBY_AUTHOR   "Yukihiro Matsumoto"

Author of this project.

Definition at line 32 of file version.h.

◆ RUBY_BIRTH_DAY

#define RUBY_BIRTH_DAY   24

Ruby's birth day.

Definition at line 41 of file version.h.

◆ RUBY_BIRTH_MONTH

#define RUBY_BIRTH_MONTH   2

Ruby's birth month.

Definition at line 38 of file version.h.

◆ RUBY_BIRTH_YEAR

#define RUBY_BIRTH_YEAR   1993

Ruby's birth year.

Definition at line 35 of file version.h.

Variable Documentation

◆ ruby_api_version

const int ruby_api_version[3]
extern

API versions, in { major, minor, teeny } order.


Definition at line 48 of file version.c.

◆ ruby_copyright

const char ruby_copyright[]
extern

Copyright notice.

Definition at line 82 of file version.c.

◆ ruby_description

const char ruby_description[]
extern

This is what ruby -v prints to the standard error.

Something like: "ruby 2.5.9p229 (2021-04-05 revision 67829) [x86_64-linux]". This doesn't include runtime options like a JIT being enabled.

Definition at line 75 of file version.c.

◆ ruby_engine

const char ruby_engine[]
extern

This is just "ruby" for us.

But different implementations can have different strings here.

Definition at line 85 of file version.c.

Referenced by ruby_process_options().

◆ ruby_patchlevel

const int ruby_patchlevel
extern

This is a monotonic increasing integer that describes specific "patch" level.

You can know the exact changeset your binary is running by this info (and ruby_version), unless this is -1. -1 means there is no release yet for the version; ruby is actively developed. 0 means the initial GA version.

Definition at line 74 of file version.c.

◆ ruby_platform

const char ruby_platform[]
extern

Target platform identifier, in a C string.

Note
Seasoned UNIX programmers should beware that this "platform identifier" is our invention; not always identical to so-called target triplets that GNU systems use. For instance on @shyouhei's machine, ruby_platform is "x64_64-linux" while its target triplet is x86_64-pc-linux-gnu.
Note also that we support Windows.

Definition at line 73 of file version.c.

◆ ruby_release_date

const char ruby_release_date[]
extern

Date of release, in a C string.

Definition at line 72 of file version.c.

◆ ruby_version

const char ruby_version[]
extern

Stringised version.

Note
This is the runtime version, not the API version. For instance it was "2.5.9" when ruby_api_version was { 2, 5, 0 }.

Definition at line 70 of file version.c.