Skip to content

Commit 1fa551f

Browse files
committed
Set extern "C" { after all R headers have been included
1 parent 23abac9 commit 1fa551f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/include/Rinternals.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
# include <cstdio>
3535
# include <climits>
3636
# include <cstddef>
37-
extern "C" {
3837
#else
3938
# include <stdio.h>
4039
# include <limits.h> /* for INT_MAX */
@@ -52,18 +51,23 @@ extern "C" {
5251

5352
#include <R_ext/libextern.h>
5453

55-
typedef unsigned char Rbyte;
56-
57-
/* type for length of (standard, not long) vectors etc */
58-
typedef int R_len_t;
59-
#define R_LEN_T_MAX INT_MAX
60-
6154
/* both config.h and Rconfig.h set SIZEOF_SIZE_T, but Rconfig.h is
6255
skipped if config.h has already been included. */
6356
#ifndef R_CONFIG_H
6457
# include <Rconfig.h>
6558
#endif
6659

60+
/* after all R headers */
61+
#ifdef __cplusplus
62+
extern "C" {
63+
#endif
64+
65+
typedef unsigned char Rbyte;
66+
67+
/* type for length of (standard, not long) vectors etc */
68+
typedef int R_len_t;
69+
#define R_LEN_T_MAX INT_MAX
70+
6771
#if ( SIZEOF_SIZE_T > 4 )
6872
# define LONG_VECTOR_SUPPORT
6973
#endif

0 commit comments

Comments
 (0)