mirror of
https://github.com/allankoechke/cparse.git
synced 2026-11-30 17:11:31 +00:00
Before this commit cparse operators, functions and reserved words were initialized at static initialization time and there was no option to change this. This could be a problem in some systems because of the static initialization fiasco: - https://isocpp.org/wiki/faq/ctors#static-init-order Now it is possible to initialize cparse inside main() which sould solve any problems caused by the problem mentioned above. To do it it's necessary to: 1. Don't add `builtin-features.o` to your compilation files. 2. Add the following code to your `main.cpp` file: ```C++ #include "cparse/builtin-features.inc" int main() { cparse_startup(); // ... Your code goes here ... } ``` This function will initialize all functions normally run at static initialization time when you include `builtin-features.o` in your code.
8 lines
143 B
C++
8 lines
143 B
C++
|
|
/**
|
|
* Force the Startup classes to run
|
|
* at static initialization time:
|
|
*/
|
|
#define STATIC_CPARSE_STARTUP
|
|
#include "./builtin-features.inc"
|