GL Studio C++ Runtime API
gls_version.h
Go to the documentation of this file.
1/// \file gls_version.h
2/// \brief Used for matching version of libraries and headers.
3/// \note THIS IS A GENERATED FILE. DO NOT MODIFY. (Edit gls_version.h.in instead.)
4///
5/// \par Copyright Information
6///
7/// Copyright (c) 2018 by The DiSTI Corporation.<br>
8/// 12249 Science Drive; Suite 300<br>
9/// Orlando, Florida 32826<br>
10/// USA<br>
11/// <br>
12/// All rights reserved.<br>
13///
14/// This Software contains proprietary trade secrets of DiSTI and may not be
15/// reproduced, in whole or part, in any form, or by any means of electronic,
16/// mechanical, or otherwise, without the written permission of DiSTI. Said
17/// permission may be derived through the purchase of applicable DiSTI product
18/// licenses which detail the distribution rights of this content and any
19/// Derivative Works based on this or other copyrighted DiSTI Software.
20///
21/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
22/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
23/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
24/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
26/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
27///
28/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
29/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
30/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
31/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
32/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
33/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
34/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
35/// EXCEED FIVE DOLLARS (US$5.00).
36///
37/// The aforementioned terms and restrictions are governed by the laws of the
38/// State of Florida and the United States of America.
39
40#ifndef INCLUDED_GLS_VERSION_H
41#define INCLUDED_GLS_VERSION_H
42
43#include "gls_include.h"
44
45// For atoi
46#include <stdlib.h>
47
48namespace disti
49{
50/*
51 GL Studio version pattern
52 -----------------------------
53 X.Y.B00M
54 X = Major version
55 Y = Minor version
56 B = Build. Increment for maintenance releases.
57 0 = Padding zeros.
58 M = Build Minor. Increment for in-house, pre-release builds and release candidates. This does not have to be zero when a product ships.
59*/
60
61/// The major version of this runtime library build. i.e. X.0.0000
62#define GLS_VERSION_MAJOR 9
63
64/// The minor version of this runtime library build. i.e. 0.X.0000
65#define GLS_VERSION_MINOR 0
66
67/// The build and build minor versions of this runtime library build. i.e. 0.0.XXXX
68#define GLS_VERSION_BUILD 0000
69
70/// Inner macro to convert preprocessor defines into strings. Don't call this directly.
71#define GLS_STRINGIZE( x ) #x
72
73/// Convenience macro to convert preprocessor defines into strings.
74#define GLS_STRINGIZE_VALUE( x ) GLS_STRINGIZE( x )
75
76/// Inner macro to build the X.Y version string. Don't call this directly.
77#define GLS_VERSION_1( a, b ) GLS_STRINGIZE( a.b )
78
79/// Macro containing the X.Y version string.
80#define GLS_VERSION GLS_VERSION_1( GLS_VERSION_MAJOR, GLS_VERSION_MINOR )
81
82/// The license version of this runtime library, matches the major version.
83/// This allows customers to upgrade within major versions without requiring an updated license.
84#define GLS_LICENSE_VERSION GLS_VERSION_1( GLS_VERSION_MAJOR, 0 )
85
86/// Macro containing the B00M version string
87#define GLS_BUILD_VERSION GLS_STRINGIZE_VALUE( GLS_VERSION_BUILD )
88
89#if defined( WIN32 )
90
91# if !defined( GLS_COMPILER_VERSION )
92# if _MSC_VER < 1910
93# pragma message( "Warning (gls_version.h): Unrecognized compiler version" )
94# define GLS_COMPILER_VERSION vcXX
95# elif _MSC_VER < 1920
96# define GLS_COMPILER_VERSION vc141
97# elif _MSC_VER < 1930
98# define GLS_COMPILER_VERSION vc142
99# elif _MSC_VER < 1950
100# define GLS_COMPILER_VERSION vc143
101# elif _MSC_VER < 1970
102# define GLS_COMPILER_VERSION vc145
103# else
104# pragma message( "Warning (gls_version.h): Unrecognized compiler version" )
105# define GLS_COMPILER_VERSION vcXX
106# endif
107# endif
108
109// 0x00FFFFFF - Reserved for _MSC_VER
110// 0x01000000 - ML
111// 0x02000000 - MT
112// 0x04000000 - DLL
113// 0x08000000 - DEBUG
114# define GLS_CRT_VERSION_INT_MD 0x06000000 // MT + DLL
115# define GLS_CRT_VERSION_INT_MT 0x02000000 // MT
116# define GLS_CRT_VERSION_INT_ML 0x01000000 // ML
117# define GLS_CRT_VERSION_INT_MDD 0x0E000000 // DEBUG + MT + DLL
118# define GLS_CRT_VERSION_INT_MTD 0x0A000000 // DEBUG + MT
119# define GLS_CRT_VERSION_INT_MLD 0x09000000 // DEBUG + ML
120
121# define GLS_CRT_VERSION_INT_MD_64 0x16000000 // MT + DLL
122# define GLS_CRT_VERSION_INT_MT_64 0x12000000 // MT
123# define GLS_CRT_VERSION_INT_ML_64 0x11000000 // ML
124# define GLS_CRT_VERSION_INT_MDD_64 0x1E000000 // DEBUG + MT + DLL
125# define GLS_CRT_VERSION_INT_MTD_64 0x1A000000 // DEBUG + MT
126# define GLS_CRT_VERSION_INT_MLD_64 0x19000000 // DEBUG + ML
127
128# if !defined( GLS_CRT_VERSION )
129# if defined( _DEBUG )
130# if defined( _MT )
131# if defined( _DLL )
132# if defined( _WIN64 )
133# define GLS_CRT_VERSION _64mdd
134# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MDD_64
135# else
136# define GLS_CRT_VERSION mdd
137# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MDD
138# endif
139# else
140# if defined( _WIN64 )
141# define GLS_CRT_VERSION _64mtd
142# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MTD_64
143# else
144# define GLS_CRT_VERSION mtd
145# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MTD
146# endif
147# endif
148# else
149# if defined( _WIN64 )
150# define GLS_CRT_VERSION _64mld
151# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MLD_64
152# else
153# define GLS_CRT_VERSION mld
154# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MLD
155# endif
156# endif
157# else
158# if defined( _MT )
159# if defined( _DLL )
160# if defined( _WIN64 )
161# define GLS_CRT_VERSION _64md
162# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MD_64
163# else
164# define GLS_CRT_VERSION md
165# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MD
166# endif
167# else
168# if defined( _WIN64 )
169# define GLS_CRT_VERSION _64mt
170# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MT_64
171# else
172# define GLS_CRT_VERSION mt
173# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MT
174# endif
175# endif
176# else
177# if defined( _WIN64 )
178# define GLS_CRT_VERSION _64ml
179# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_ML_64
180# else
181# define GLS_CRT_VERSION ml
182# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_ML
183# endif
184# endif
185# endif
186# endif
187
188/// Inner macro to stringize all parts of the version check string. Don't call directly.
189# define GLS_CHECK_VERSION_ID_2( a, b, c, d, e ) GLS_VERSION_##a##_##b##_##c##_##d##_##e // Complete check
190
191/// Outer macro to build the version check string. Don't call directly.
192# define GLS_CHECK_VERSION_ID_1( v1, v2, v3, c1, c2 ) GLS_CHECK_VERSION_ID_2( v1, v2, v3, c1, c2 )
193
194/// The version check string, present as a symbol in the runtime library.
195# define GLS_CHECK_VERSION_ID GLS_CHECK_VERSION_ID_1( GLS_VERSION_MAJOR, GLS_VERSION_MINOR, GLS_VERSION_BUILD, GLS_COMPILER_VERSION, GLS_CRT_VERSION )
196
197#else // UNIX
198
199/// Inner macro to stringize all parts of the version check string. Don't call directly.
200# define GLS_CHECK_VERSION_ID_2( a, b, c ) GLS_VERSION_##a##_##b##_##c##_LIBRARY
201
202/// Outer macro to build the version check string. Don't call directly.
203# define GLS_CHECK_VERSION_ID_1( v1, v2, v3 ) GLS_CHECK_VERSION_ID_2( v1, v2, v3 )
204
205/// The version check string, present as a symbol in the runtime library.
206# define GLS_CHECK_VERSION_ID GLS_CHECK_VERSION_ID_1( GLS_VERSION_MAJOR, GLS_VERSION_MINOR, GLS_VERSION_BUILD )
207
208#endif
209
210/// The version symbol string as instantated in this runtime library build.
211/// Used to ensure a linker error if the runtime library being linked doesn't match the runtime headers being built against.
212/// If a linker error occurs related to this identifier, double check to make sure the correct runtime library is being linked.
214
215/** This is a type which shall remain consistant. If an item must
216 * be added, it shall be added at the end of the structure to avoid
217 * compatibility issues.
218 * This object is used to check dynamically loaded code with the container
219 * performing the load.
220 * This must be inline to work properly.
221 */
223{
224public:
225 int _glsMajor; ///< The major runtime version.
226 int _glsMinor; ///< The minor runtime version.
227 int _glsBuild; ///< The build, and build minor runtime version.
228 int _compilerVersion; ///< The compiler version.
229
230 /// Constructor
231 /// \param glsMajor The major runtime version.
232 /// \param glsMinor The minor runtime version.
233 /// \param glsBuild The build, and build minor runtime version.
234 /// \param compilerVersion The compiler version.
236 int glsMajor = GLS_VERSION_MAJOR,
237 int glsMinor = GLS_VERSION_MINOR,
238 int glsBuild = GLS_VERSION_BUILD,
239#if defined( _MSC_VER )
240 int compilerVersion = _MSC_VER + GLS_CRT_VERSION_INT ) // Complete check
241#elif defined( __GNUC__ )
242 int compilerVersion = __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
243#else
244 int compilerVersion = 0 )
245#endif
246 {
247 _glsMajor = glsMajor;
248 _glsMinor = glsMinor;
249 _glsBuild = glsBuild;
250 _compilerVersion = compilerVersion;
251 }
252};
253
254typedef GlsBuiltVersionInfo2 GlsBuiltVersionInfo; ///< Typedef for backward compatibilty purposes.
255
256/// \return True if the version info matches exactly (they reference the same shared library).
257/// \param a One set of version info to compare.
258/// \param b The other set of version info to compare.
260{
262}
263
264/// \return True if the versions are binary compatible (may be different shared library, but they are link compatible).
265/// \param a One set of version info to compare.
266/// \param b The other set of version info to compare.
268{
269 bool compiler_compatible = ( a._compilerVersion == b._compilerVersion );
270
271#if defined( __GNUC__ )
272 if( !compiler_compatible )
273 {
274 if( a._compilerVersion >= 30400 && b._compilerVersion >= 30400 )
275 {
276 // GCC 3.4.0 or newer
277 // The C runtime library changed with 3.4.0
278 compiler_compatible = true;
279 }
280 }
281#endif
282
283 // If this does not match, we fallback to RSO interface
284 return ( compiler_compatible && a._glsMajor == b._glsMajor && a._glsMinor == b._glsMinor && a._glsBuild / 1000 == b._glsBuild / 1000 );
285}
286
287} // namespace disti
288
289#endif
Definition: gls_version.h:223
GlsBuiltVersionInfo2(int glsMajor=9, int glsMinor=0, int glsBuild=0000, int compilerVersion=0)
Definition: gls_version.h:235
int _glsBuild
The build, and build minor runtime version.
Definition: gls_version.h:227
int _glsMinor
The minor runtime version.
Definition: gls_version.h:226
int _glsMajor
The major runtime version.
Definition: gls_version.h:225
int _compilerVersion
The compiler version.
Definition: gls_version.h:228
A file for all GL Studio files to include.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:50
#define GLS_CHECK_VERSION_ID
The version check string, present as a symbol in the runtime library.
Definition: gls_version.h:206
#define GLS_VERSION_MINOR
The minor version of this runtime library build. i.e. 0.X.0000.
Definition: gls_version.h:65
#define GLS_VERSION_MAJOR
The major version of this runtime library build. i.e. X.0.0000.
Definition: gls_version.h:62
#define GLS_VERSION_BUILD
The build and build minor versions of this runtime library build. i.e. 0.0.XXXX.
Definition: gls_version.h:68
Definition: bmpimage.h:46
bool GlsBuiltVersionsMatchExactly(const GlsBuiltVersionInfo &a, const GlsBuiltVersionInfo &b)
Definition: gls_version.h:259
bool GlsBuiltVersionsAreBinaryCompatible(const GlsBuiltVersionInfo &a, const GlsBuiltVersionInfo &b)
Definition: gls_version.h:267
GlsBuiltVersionInfo2 GlsBuiltVersionInfo
Typedef for backward compatibilty purposes.
Definition: gls_version.h:254