| GL Studio C++ Runtime API

gls_version.h
Go to the documentation of this file.
1/*! \file
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 11301 Corporate Blvd; Suite 100<br>
9 Orlando, Florida 32817<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*/
41
42#ifndef INCLUDED_GLS_VERSION_H
43#define INCLUDED_GLS_VERSION_H
44
45#include "gls_include.h"
46
47// For atoi
48#include <stdlib.h>
49
50 namespace disti
51{
52/*
53 GL Studio version pattern
54 -----------------------------
55 X.Y.B00M
56 X = Major version
57 Y = Minor version
58 B = Build. Increment for maintenance releases.
59 0 = Padding zeros.
60 M = Build Minor. Increment for in-house, pre-release builds and release candidates. This does not have to be zero when a product ships.
61*/
62
63/// The major version of this runtime library build. i.e. X.0.0000
64#define GLS_VERSION_MAJOR 8
65
66/// The minor version of this runtime library build. i.e. 0.X.0000
67#define GLS_VERSION_MINOR 3
68
69/// The build and build minor versions of this runtime library build. i.e. 0.0.XXXX
70#define GLS_VERSION_BUILD 0000
71
72/// Inner macro to convert preprocessor defines into strings. Don't call this directly.
73#define GLS_STRINGIZE( x ) #x
74
75/// Convenience macro to convert preprocessor defines into strings.
76#define GLS_STRINGIZE_VALUE( x ) GLS_STRINGIZE( x )
77
78/// Inner macro to build the X.Y version string. Don't call this directly.
79#define GLS_VERSION_1( a, b ) GLS_STRINGIZE( a.b )
80
81/// Macro containing the X.Y version string.
82#define GLS_VERSION GLS_VERSION_1( GLS_VERSION_MAJOR, GLS_VERSION_MINOR )
83
84/// The license version of this runtime library, matches the major version.
85/// This allows customers to upgrade within major versions without requiring an updated license.
86#define GLS_LICENSE_VERSION GLS_VERSION_1( GLS_VERSION_MAJOR, 0 )
87
88/// Macro containing the B00M version string
89#define GLS_BUILD_VERSION GLS_STRINGIZE_VALUE( GLS_VERSION_BUILD )
90
91#if defined( WIN32 )
92
93# if !defined( GLS_COMPILER_VERSION )
94# if _MSC_VER < 1400
95# pragma message( "Warning (gls_version.h): Unrecognized compiler version" )
96# define GLS_COMPILER_VERSION vcXX
97# else
98# if _MSC_VER < 1700
99# pragma message( "Warning (gls_version.h): Unrecognized compiler version" )
100# define GLS_COMPILER_VERSION vcXX
101# elif _MSC_VER < 1800
102# define GLS_COMPILER_VERSION vc110
103# elif _MSC_VER < 1900
104# define GLS_COMPILER_VERSION vc120
105# elif _MSC_VER < 1910
106# define GLS_COMPILER_VERSION vc140
107# elif _MSC_VER < 1920
108# define GLS_COMPILER_VERSION vc141
109# elif _MSC_VER < 1930
110# define GLS_COMPILER_VERSION vc142
111# elif _MSC_VER < 1950
112# define GLS_COMPILER_VERSION vc143
113# else
114# pragma message( "Warning (gls_version.h): Unrecognized compiler version" )
115# define GLS_COMPILER_VERSION vcXX
116# endif
117# endif
118# endif
119
120// 0x00FFFFFF - Reserved for _MSC_VER
121// 0x01000000 - ML
122// 0x02000000 - MT
123// 0x04000000 - DLL
124// 0x08000000 - DEBUG
125# define GLS_CRT_VERSION_INT_MD 0x06000000 // MT + DLL
126# define GLS_CRT_VERSION_INT_MT 0x02000000 // MT
127# define GLS_CRT_VERSION_INT_ML 0x01000000 // ML
128# define GLS_CRT_VERSION_INT_MDD 0x0E000000 // DEBUG + MT + DLL
129# define GLS_CRT_VERSION_INT_MTD 0x0A000000 // DEBUG + MT
130# define GLS_CRT_VERSION_INT_MLD 0x09000000 // DEBUG + ML
131
132# define GLS_CRT_VERSION_INT_MD_64 0x16000000 // MT + DLL
133# define GLS_CRT_VERSION_INT_MT_64 0x12000000 // MT
134# define GLS_CRT_VERSION_INT_ML_64 0x11000000 // ML
135# define GLS_CRT_VERSION_INT_MDD_64 0x1E000000 // DEBUG + MT + DLL
136# define GLS_CRT_VERSION_INT_MTD_64 0x1A000000 // DEBUG + MT
137# define GLS_CRT_VERSION_INT_MLD_64 0x19000000 // DEBUG + ML
138
139# if !defined( GLS_CRT_VERSION )
140# if defined( _DEBUG )
141# if defined( _MT )
142# if defined( _DLL )
143# if defined( _WIN64 )
144# define GLS_CRT_VERSION _64mdd
145# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MDD_64
146# else
147# define GLS_CRT_VERSION mdd
148# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MDD
149# endif
150# else
151# if defined( _WIN64 )
152# define GLS_CRT_VERSION _64mtd
153# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MTD_64
154# else
155# define GLS_CRT_VERSION mtd
156# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MTD
157# endif
158# endif
159# else
160# if defined( _WIN64 )
161# define GLS_CRT_VERSION _64mld
162# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MLD_64
163# else
164# define GLS_CRT_VERSION mld
165# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MLD
166# endif
167# endif
168# else
169# if defined( _MT )
170# if defined( _DLL )
171# if defined( _WIN64 )
172# define GLS_CRT_VERSION _64md
173# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MD_64
174# else
175# define GLS_CRT_VERSION md
176# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MD
177# endif
178# else
179# if defined( _WIN64 )
180# define GLS_CRT_VERSION _64mt
181# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MT_64
182# else
183# define GLS_CRT_VERSION mt
184# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_MT
185# endif
186# endif
187# else
188# if defined( _WIN64 )
189# define GLS_CRT_VERSION _64ml
190# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_ML_64
191# else
192# define GLS_CRT_VERSION ml
193# define GLS_CRT_VERSION_INT GLS_CRT_VERSION_INT_ML
194# endif
195# endif
196# endif
197# endif
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, d, e ) GLS_VERSION_##a##_##b##_##c##_##d##_##e // Complete check
201
202/// Outer macro to build the version check string. Don't call directly.
203# define GLS_CHECK_VERSION_ID_1( v1, v2, v3, c1, c2 ) GLS_CHECK_VERSION_ID_2( v1, v2, v3, c1, c2 )
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, GLS_COMPILER_VERSION, GLS_CRT_VERSION )
207
208#else // UNIX
209
210/// Inner macro to stringize all parts of the version check string. Don't call directly.
211# define GLS_CHECK_VERSION_ID_2( a, b, c ) GLS_VERSION_##a##_##b##_##c##_LIBRARY
212
213/// Outer macro to build the version check string. Don't call directly.
214# define GLS_CHECK_VERSION_ID_1( v1, v2, v3 ) GLS_CHECK_VERSION_ID_2( v1, v2, v3 )
215
216/// The version check string, present as a symbol in the runtime library.
217# define GLS_CHECK_VERSION_ID GLS_CHECK_VERSION_ID_1( GLS_VERSION_MAJOR, GLS_VERSION_MINOR, GLS_VERSION_BUILD )
218
219#endif
220
221/// The version symbol string as instantated in this runtime library build.
222/// Used to ensure a linker error if the runtime library being linked doesn't match the runtime headers being built against.
223/// If a linker error occurs related to this identifier, double check to make sure the correct runtime library is being linked.
224 GLS_EXPORT void GLS_CHECK_VERSION_ID();
225
226/** This is a type which shall remain consistant. If an item must
227 * be added, it shall be added at the end of the structure to avoid
228 * compatibility issues.
229 * This object is used to check dynamically loaded code with the container
230 * performing the load.
231 * This must be inline to work properly.
232 */
233 class GlsBuiltVersionInfo2
234{
235 public:
236 int _glsMajor; ///< The major runtime version.
237 int _glsMinor; ///< The minor runtime version.
238 int _glsBuild; ///< The build, and build minor runtime version.
239 int _compilerVersion; ///< The compiler version.
240
241 /// Constructor
242 /// \param glsMajor The major runtime version.
243 /// \param glsMinor The minor runtime version.
244 /// \param glsBuild The build, and build minor runtime version.
245 /// \param compilerVersion The compiler version.
246 inline GlsBuiltVersionInfo2(
247 int glsMajor = GLS_VERSION_MAJOR,
248 int glsMinor = GLS_VERSION_MINOR,
249 int glsBuild = GLS_VERSION_BUILD,
250#if defined( _MSC_VER )
251 int compilerVersion = _MSC_VER + GLS_CRT_VERSION_INT ) // Complete check
252#elif defined( __GNUC__ )
253 int compilerVersion = __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
254#else
255 int compilerVersion = 0 )
256#endif
257 {
258 _glsMajor = glsMajor;
259 _glsMinor = glsMinor;
260 _glsBuild = glsBuild;
261 _compilerVersion = compilerVersion;
262 }
263};
264
265 typedef GlsBuiltVersionInfo2 GlsBuiltVersionInfo; ///< Typedef for backward compatibilty purposes.
266
267/// \return True if the version info matches exactly (they reference the same shared library).
268/// \param a One set of version info to compare.
269/// \param b The other set of version info to compare.
270 inline bool GlsBuiltVersionsMatchExactly( const GlsBuiltVersionInfo& a, const GlsBuiltVersionInfo& b )
271{
272 return a._glsMajor == b._glsMajor && a._glsMinor == b._glsMinor && a._glsBuild == b._glsBuild && a._compilerVersion == b._compilerVersion;
273}
274
275/// \return True if the versions are binary compatible (may be different shared library, but they are link compatible).
276/// \param a One set of version info to compare.
277/// \param b The other set of version info to compare.
278 inline bool GlsBuiltVersionsAreBinaryCompatible( const GlsBuiltVersionInfo& a, const GlsBuiltVersionInfo& b )
279{
280 bool compiler_compatible = ( a._compilerVersion == b._compilerVersion );
281
282#if defined( __GNUC__ )
283 if( !compiler_compatible )
284 {
285 if( a._compilerVersion >= 30400 && b._compilerVersion >= 30400 )
286 {
287 // GCC 3.4.0 or newer
288 // The C runtime library changed with 3.4.0
289 compiler_compatible = true;
290 }
291 }
292#endif
293
294 // If this does not match, we fallback to RSO interface
295 return ( compiler_compatible && a._glsMajor == b._glsMajor && a._glsMinor == b._glsMinor && a._glsBuild / 1000 == b._glsBuild / 1000 );
296}
297
298} // namespace disti
299
300#endif
disti::GlsBuiltVersionInfo2
Definition: gls_version.h:234
disti::GlsBuiltVersionInfo2::_glsBuild
int _glsBuild
The build, and build minor runtime version.
Definition: gls_version.h:238
disti::GlsBuiltVersionInfo2::_glsMinor
int _glsMinor
The minor runtime version.
Definition: gls_version.h:237
disti::GlsBuiltVersionInfo2::_glsMajor
int _glsMajor
The major runtime version.
Definition: gls_version.h:236
disti::GlsBuiltVersionInfo2::_compilerVersion
int _compilerVersion
The compiler version.
Definition: gls_version.h:239
disti::GlsBuiltVersionInfo2::GlsBuiltVersionInfo2
GlsBuiltVersionInfo2(int glsMajor=8, int glsMinor=3, int glsBuild=0000, int compilerVersion=0)
Definition: gls_version.h:246
gls_include.h
A file for all GL Studio files to include.
GLS_EXPORT
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
GLS_CHECK_VERSION_ID
#define GLS_CHECK_VERSION_ID
The version check string, present as a symbol in the runtime library.
Definition: gls_version.h:217
GLS_VERSION_MINOR
#define GLS_VERSION_MINOR
The minor version of this runtime library build. i.e. 0.X.0000.
Definition: gls_version.h:67
GLS_VERSION_MAJOR
#define GLS_VERSION_MAJOR
The major version of this runtime library build. i.e. X.0.0000.
Definition: gls_version.h:64
GLS_VERSION_BUILD
#define GLS_VERSION_BUILD
The build and build minor versions of this runtime library build. i.e. 0.0.XXXX.
Definition: gls_version.h:70
disti
Definition: bmpimage.h:47
disti::GlsBuiltVersionsMatchExactly
bool GlsBuiltVersionsMatchExactly(const GlsBuiltVersionInfo &a, const GlsBuiltVersionInfo &b)
Definition: gls_version.h:270
disti::GlsBuiltVersionsAreBinaryCompatible
bool GlsBuiltVersionsAreBinaryCompatible(const GlsBuiltVersionInfo &a, const GlsBuiltVersionInfo &b)
Definition: gls_version.h:278
disti::GlsBuiltVersionInfo
GlsBuiltVersionInfo2 GlsBuiltVersionInfo
Typedef for backward compatibilty purposes.
Definition: gls_version.h:265