Sorry if this sounds too naive (I now little about R,),<div>but what is wrong with using the types</div><div><br></div><div>  uint64_t, int64_t etc </div><div><br></div><div>which are defined in the c++ standard header <cstdint>?</div>
<div><br></div><div>           walter.<br><br><div class="gmail_quote">On Wed, Jul 11, 2012 at 4:34 PM, Bob Carpenter <span dir="ltr"><<a href="mailto:carp@alias-i.com" target="_blank">carp@alias-i.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jiqiang created a standalone example that illustrates<br>
our problem with wrapping size_t into Rcpp on Win64.<br>
The simple example is as follows (full running dump<br>
from R/Rcpp below):<br>
<br>
   size_t b = 100;<br>
   Rcpp::List lst(a);<br>
   lst["b"] = b;<br>
   return lst;<br>
<br>
We found this discussion:<br>
<br>
<a href="http://stackoverflow.com/questions/8931123/return-wrap-of-size-t-in-rcpp" target="_blank">http://stackoverflow.com/<u></u>questions/8931123/return-wrap-<u></u>of-size-t-in-rcpp</a><br>
<br>
where Romain suggests just avoiding size_t and long long<br>
altogether.  We're willing to fly in the face of all the<br>
other advice we've ever gotten (which is to use "size_t" for<br>
portability), but we don't know how to specify the type of<br>
size_t in Win64 given that Romain doesn't want us to use<br>
"size_t" or "unsigned long long".  Unfortunately, "unsigned long"<br>
is only 32 bits on Windows.<br>
<br>
I'm following Dirk's final comment on Stack Overflow<br>
and "taking it to the [rcpp] list".<br>
<br>
How should we specify the type of size_t in<br>
Windows 64 bit given that we can't say "size_t" or "unsigned<br>
long long"?  The only other option seems to be "unsigned __int64".<br>
Here's the full table of types from the horse's mouth:<br>
<br>
   <a href="http://msdn.microsoft.com/en-us/library/s3f49ktz(v=VS.80).aspx" target="_blank">http://msdn.microsoft.com/en-<u></u>us/library/s3f49ktz(v=VS.80).<u></u>aspx</a><br>
<br>
- Bob Carpenter & Jiqiang Guo<br>
  Columbia Uni., Dept. of Statistics<br>
<br>
<br>
P.S.  Here's the full dump:<br>
<br>
> library(Rcpp)<br>
> library(inline)<br>
><br>
> sessionInfo()<br>
R version 2.15.1 (2012-06-22)<br>
Platform: x86_64-pc-mingw32/x64 (64-bit)<br>
<br>
locale:<br>
[1] LC_COLLATE=English_United States.1252<br>
[2] LC_CTYPE=English_United States.1252<br>
[3] LC_MONETARY=English_United States.1252<br>
[4] LC_NUMERIC=C<br>
[5] LC_TIME=English_United States.1252<br>
<br>
attached base packages:<br>
[1] stats     graphics  grDevices utils     datasets  methods base<br>
<br>
other attached packages:<br>
[1] inline_0.3.8 Rcpp_0.9.13<br>
><br>
> src <- '<br>
+   size_t b = 100;<br>
+   Rcpp::List lst(a);<br>
+   lst["b"] = b;<br>
+   return lst;<br>
+ '<br>
><br>
> fx <- cxxfunction(signature(a = 'list'), body = src, includes = '',<br>
+                   plugin = 'Rcpp', verbose = !TRUE)<br>
In file included from C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/RcppCommon.h:326:0,<br>
                 from C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp.h:27,<br>
                 from file8c8759b1a9b.cpp:4:<br>
C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h: In function 'SEXPREC* Rcpp::internal::wrap_dispatch_<u></u>unknown_iterable(const T&, Rcpp::traits::false_type) [with T = long long unsigned int, SEXP = SEXPREC*, Rcpp::traits::false_type = Rcpp::traits::integral_<u></u>constant<bool, false>]':<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>638:98: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_<u></u>unknown(const T&, Rcpp::traits::false_type) [with T = long long unsigned int, SEXP = SEXPREC*, Rcpp::traits::false_type = Rcpp::traits::integral_<u></u>constant<bool, false>]'<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>654:96: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_<u></u>eigen(const T&, Rcpp::traits::false_type) [with T = long long unsigned int, SEXP = SEXPREC*, Rcpp::traits::false_type = Rcpp::traits::integral_<u></u>constant<bool, false>]'<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>669:80: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_<u></u>unknown_importable(const T&, Rcpp::traits::false_type) [with T = long long unsigned int, SEXP = SEXPREC*, Rcpp::traits::false_type = Rcpp::traits::integral_<u></u>constant<bool, false>]'<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>687:99: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch(<u></u>const T&, Rcpp::traits::wrap_type_<u></u>unknown_tag) [with T = long long unsigned int, SEXP = SEXPREC*]'<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>791:104: instantiated from 'SEXPREC* Rcpp::wrap(const T&) [with T = long long unsigned int, SEXP = SEXPREC*]'<br>
C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/vector/proxy.h:<u></u>155:4: instantiated from 'Rcpp::internal::generic_name_<u></u>proxy<RTYPE>& Rcpp::internal::generic_name_<u></u>proxy<RTYPE>::operator=(const T&) [with T = long long unsigned int, int RTYPE = 19, Rcpp::internal::generic_name_<u></u>proxy<RTYPE> = Rcpp::internal::generic_name_<u></u>proxy<19>]'<br>

file8c8759b1a9b.cpp:33:14:   instantiated from here<br>
C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>433:11: error: invalid conversion from 'long long unsigned int' to 'SEXP' [-fpermissive]<br>
make: *** [file8c8759b1a9b.o] Error 1<br>
<br>
ERROR(s) during compilation: source code errors or compiler configuration errors!<br>
<br>
Program source:<br>
  1:<br>
  2: // includes from the plugin<br>
  3:<br>
  4: #include <Rcpp.h><br>
  5:<br>
  6:<br>
  7: #ifndef BEGIN_RCPP<br>
  8: #define BEGIN_RCPP<br>
  9: #endif<br>
 10:<br>
 11: #ifndef END_RCPP<br>
 12: #define END_RCPP<br>
 13: #endif<br>
 14:<br>
 15: using namespace Rcpp;<br>
 16:<br>
 17:<br>
 18: // user includes<br>
 19:<br>
 20:<br>
 21: // declarations<br>
 22: extern "C" {<br>
 23: SEXP file8c8759b1a9b( SEXP a) ;<br>
 24: }<br>
 25:<br>
 26: // definition<br>
 27:<br>
 28: SEXP file8c8759b1a9b( SEXP a ){<br>
 29: BEGIN_RCPP<br>
 30:<br>
 31:   size_t b = 100;<br>
 32:   Rcpp::List lst(a);<br>
 33:   lst["b"] = b;<br>
 34:   return lst;<br>
 35:<br>
 36: END_RCPP<br>
 37: }<br>
 38:<br>
 39:<br>
Error in compileCode(f, code, language = language, verbose = verbose) :<br>
  Compilation ERROR, function(s)/method(s) not created! In file included from C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/RcppCommon.h:326:0,<br>
                 from C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp.h:27,<br>
                 from file8c8759b1a9b.cpp:4:<br>
C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h: In function 'SEXPREC* Rcpp::internal::wrap_dispatch_<u></u>unknown_iterable(const T&, Rcpp::traits::false_type) [with T = long long unsigned int, SEXP = SEXPREC*, Rcpp::traits::false_type = Rcpp::traits::integral_<u></u>constant<bool, false>]':<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>638:98: instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_<u></u>unknown(const T&, Rcpp::traits::false_type) [with T = long long unsigned int, SEXP = SEXPREC*, Rcpp::traits::false_type = Rcpp::traits::integral_<u></u>constant<bool, false>]'<br>

C:/Program Files/R/R-2.15.1/library/Rcpp/<u></u>include/Rcpp/internal/wrap.h:<u></u>654:96: instantiated from 'SEXPREC* R<br>
Calls: cxxfunction -> compileCode<br>
In addition: Warning message:<br>
running command 'C:/PROGRA~1/R/R-215~1.1/bin/<u></u>x64/R CMD SHLIB file8c8759b1a9b.cpp 2> file8c8759b1a9b.cpp.err.txt' had status 1<br>
Execution halted<br>
<br>
______________________________<u></u>_________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-<u></u>project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/rcpp-devel</a><br>
</blockquote></div><br></div>