From becker@g@be @ending from gene@com  Tue Oct  9 17:00:08 2018
From: becker@g@be @ending from gene@com (Gabe Becker)
Date: Tue, 9 Oct 2018 08:00:08 -0700
Subject: [Rd] R_ext/Altrep.h should be more C++-friendly
In-Reply-To: <CAHPe-e8S9Gp1jnx5=Uu2jjJc1kn6XOjB=1ie4iuMzL3bXTcnJQ@mail.gmail.com>
References: <CAHPe-e8S9Gp1jnx5=Uu2jjJc1kn6XOjB=1ie4iuMzL3bXTcnJQ@mail.gmail.com>
Message-ID: <CAMFmJsmyMoJD=AAhRfF7mFA4=FzMA=M-k=9kAcBg+Uy41c1CwA@mail.gmail.com>

Michael,

Thanks for reaching out. This was brought up by Romaine Francois offline to
me as well. What he does as a workaround is


#define class klass
extern "C" {
  #include <R_ext/Altrep.h>
}
#undef class

While we consider changing Altrep.h, the above should work for you  in the
immediate term.

Let me know if it doesn't.

~G





On Mon, Oct 8, 2018 at 4:17 PM, Michael Sannella via R-devel <
r-devel at r-project.org> wrote:

> I am not able to #include "R_ext/Altrep.h" from a C++ file.  I think
> it needs two changes:
>
> 1. add the same __cplusplus check as most of the other header files:
>     #ifdef  __cplusplus
>     extern "C" {
>     #endif
>         ...
>     #ifdef  __cplusplus
>     }
>     #endif
>
> 2. change the line
>     R_new_altrep(R_altrep_class_t class, SEXP data1, SEXP data2);
>  to
>     R_new_altrep(R_altrep_class_t cls, SEXP data1, SEXP data2);
>  since C++ doesn't like an argument named 'class'
>
>   ~~ Michael Sannella
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>


-- 
Gabriel Becker, Ph.D
Scientist
Bioinformatics and Computational Biology
Genentech Research

	[[alternative HTML version deleted]]



[Rd] R_ext/Altrep.h should be more C++-friendly
Gabe Becker