|
27 | 27 | #define _MAIN_H |
28 | 28 |
|
29 | 29 | #define REB_API // Public REBOUND API definitions |
| 30 | + |
| 31 | +// The restrict keyword has different spellings in different compilers |
| 32 | +#if defined(_MSC_VER) |
| 33 | +#define REB_RESTRICT __restrict |
| 34 | +#pragma comment(lib, "legacy_stdio_definitions.lib") // for printf, etc |
| 35 | +#elif defined(__GNUC__) || defined(__clang__) |
| 36 | +#define REB_RESTRICT __restrict__ |
| 37 | +#else |
30 | 38 | #define REB_RESTRICT restrict |
| 39 | +#endif |
31 | 40 |
|
32 | | -// Operating system specific options. |
33 | 41 | // Windows requires special treatment. |
34 | 42 | #ifdef _WIN64 |
35 | 43 | #define _LP64 // automatically defined on 64bit Linux and MacOS |
36 | 44 | #endif // _WIN64 |
37 | 45 | #ifdef _WIN32 |
38 | 46 | #define _USE_MATH_DEFINES // Windows (MVSC) does not include math constants by default. |
39 | | -#define REB_RESTRICT |
40 | 47 | // Windows needs different declarations depending on whether the library is built or used. |
41 | 48 | #ifdef BUILDINGLIBREBOUND |
42 | 49 | #define REB_API __declspec(dllexport) |
43 | 50 | #else |
44 | 51 | #define REB_API __declspec(dllimport) |
45 | 52 | #endif |
46 | | -#ifdef _MSC_VER |
47 | | -#pragma comment(lib, "legacy_stdio_definitions.lib") // for printf, etc |
48 | | -#endif |
49 | 53 | #endif // _WIN32 |
50 | 54 |
|
51 | 55 | #include <stdlib.h> // for size_t |
@@ -81,7 +85,7 @@ struct reb_particle { |
81 | 85 | double az; |
82 | 86 | double m; // Mass in code units |
83 | 87 | double r; // Physical radius in code units |
84 | | - const char* name; // Pointer to a NULL terminated string with the particle's name. |
| 88 | + const char* name; // Pointer to a NULL terminated string with the particle's name. Memory owned by simulation. |
85 | 89 | #if !defined(_LP64) |
86 | 90 | char pad2[4]; // Padding. ap is not padded to 8 bytes |
87 | 91 | #endif |
|
0 commit comments