Files
cparse/builtin-features.cpp
Vinícius Garcia 5d1fa1b44f Add an easy way to initialize cpase inside main() function
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.
2018-04-12 20:32:54 -03:00

8 lines
143 B
C++

/**
* Force the Startup classes to run
* at static initialization time:
*/
#define STATIC_CPARSE_STARTUP
#include "./builtin-features.inc"