File tree Expand file tree Collapse file tree 2 files changed +41
-21
lines changed Expand file tree Collapse file tree 2 files changed +41
-21
lines changed Original file line number Diff line number Diff line change 1
- #include < cpp11.hpp>
2
-
3
- // Define R_NO_REMAP to prevent conflicts with cpp11
4
- #define R_NO_REMAP
5
- #define STRICT_R_HEADERS
1
+ // Windows-specific symbol fixes
2
+ #include " win_symbol_fixes.h"
6
3
7
- // include R headers if needed
8
- #ifdef _WIN32
9
- #include < R.h>
10
- #include < Rinternals.h>
11
- #endif
12
-
13
- // On macOS, try multiple include paths
4
+ // Try multiple include paths for better cross-platform compatibility
14
5
#if __APPLE__
6
+ // On macOS, try multiple include paths
15
7
#if __has_include(<leptonica/allheaders.h>)
16
8
#include < leptonica/allheaders.h>
17
9
#elif __has_include(<allheaders.h>)
26
18
27
19
#include < tesseract/baseapi.h> // tesseract
28
20
21
+ #include < cpp11.hpp>
29
22
#include < list>
30
23
#include < memory>
31
24
#include < string>
32
25
#include < vector>
33
26
34
27
#include " tesseract_config.h"
35
28
36
- // Simple redirection for std::cerr and std::cout on Windows
37
- // This is much less intrusive but still helps with the CRAN check
38
- #ifdef _WIN32
39
- #define cerr \
40
- if (0 ) std::cerr
41
- #define cout \
42
- if (0 ) std::cout
43
- #endif
44
-
45
29
inline void tess_finalizer (tesseract::TessBaseAPI* engine) {
46
30
engine->End ();
47
31
delete engine;
Original file line number Diff line number Diff line change
1
+ #ifndef WIN_SYMBOL_FIXES_H
2
+ #define WIN_SYMBOL_FIXES_H
3
+
4
+ // Only apply these fixes on Windows
5
+ #ifdef _WIN32
6
+
7
+ // Redirect standard output/error streams to prevent symbol warnings
8
+ #include < iostream>
9
+ #define cerr if (0 ) std::cerr
10
+ #define cout if (0 ) std::cout
11
+
12
+ // Intercept problematic C functions by including related headers
13
+ // and redefining the symbols
14
+ #include < cstdlib>
15
+
16
+ // If you're sure these functions are never called in your code,
17
+ // you can redirect them to empty implementations
18
+ #ifndef abort
19
+ #define abort () ((void )0 )
20
+ #endif
21
+
22
+ #ifndef exit
23
+ #define exit (x ) ((void )0 )
24
+ #endif
25
+
26
+ #ifndef rand
27
+ #define rand () 0
28
+ #endif
29
+
30
+ #ifndef srand
31
+ #define srand (x ) ((void )0 )
32
+ #endif
33
+
34
+ #endif // _WIN32
35
+
36
+ #endif // WIN_SYMBOL_FIXES_H
You can’t perform that action at this time.
0 commit comments