#endif
#endif // !defined(FLATBUFFERS_LITTLEENDIAN)
+#ifndef WIN32
+#define FLATBUFFERS_WEAK __attribute__((weak))
+#else
+#define FLATBUFFERS_WEAK __declspec(selectany)
+#endif // WIN32
+
#define FLATBUFFERS_VERSION_MAJOR 1
#define FLATBUFFERS_VERSION_MINOR 0
#define FLATBUFFERS_VERSION_REVISION 0
offsetbuf_.reserve(16); // Avoid first few reallocs.
vtables_.reserve(16);
EndianCheck();
- flatbuffer_version_string =
- "FlatBuffers "
- FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MAJOR) "."
- FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MINOR) "."
- FLATBUFFERS_STRING(FLATBUFFERS_VERSION_REVISION);
}
// Reset all the state in this FlatBufferBuilder so it can be reused
// Get the serialized buffer (after you call Finish()).
uint8_t *GetBufferPointer() const { return buf_.data(); }
- const char *GetVersionString() { return flatbuffer_version_string; }
-
void ForceDefaults(bool fd) { force_defaults_ = fd; }
void Pad(size_t num_bytes) { buf_.fill(num_bytes); }
size_t minalign_;
bool force_defaults_; // Serialize values equal to their defaults anyway.
-
- // String which identifies the current version of FlatBuffers.
- // flatbuffer_version_string is used by Google developers to identify which
- // applications uploaded to Google Play are using this library. This allows
- // the development team at Google to determine the popularity of the library.
- // How it works: Applications that are uploaded to the Google Play Store are
- // scanned for this version string. We track which applications are using it
- // to measure popularity. You are free to remove it (of course) but we would
- // appreciate if you left it in.
- const char *flatbuffer_version_string;
};
// Helper to get a typed pointer to the root object contained in the buffer.
#error Unknown compiler, please define structure alignment macros
#endif
+// String which identifies the current version of FlatBuffers.
+// flatbuffer_version_string is used by Google developers to identify which
+// applications uploaded to Google Play are using this library. This allows
+// the development team at Google to determine the popularity of the library.
+// How it works: Applications that are uploaded to the Google Play Store are
+// scanned for this version string. We track which applications are using it
+// to measure popularity. You are free to remove it (of course) but we would
+// appreciate if you left it in.
+
+extern volatile FLATBUFFERS_WEAK const char *flatbuffer_version_string;
+volatile FLATBUFFERS_WEAK const char *flatbuffer_version_string =
+ "FlatBuffers "
+ FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MAJOR) "."
+ FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MINOR) "."
+ FLATBUFFERS_STRING(FLATBUFFERS_VERSION_REVISION);
+
} // namespace flatbuffers
#endif // FLATBUFFERS_H_