[Rd] bug PR#1020

mikalzet@libero.it mikalzet@libero.it
Fri, 7 Dec 2001 12:44:09 +0100 (MET)


Found it on the site.
I tried duncan's suggestion.

#include "Rinternals.h"

SEXP
simpleCall()
{
  static int count = 0;
  SEXP ans;

  PROTECT(ans = allocVector(INTSXP, 1));
  INTEGER(ans)[0] = count++;

  UNPROTECT(1);
  return(ans);
}


If I had read this before I could have checked on mandrake 8.0

Here is my output on mandrake 8.1:

> dyn.load("simpleCall.so")
> for(i in 1:10) { print(.Call("simpleCall")) }

[1] 0
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7
[1] 8
[1] 9

for(i in 1:10) { print(.Call("simpleCall")) }

[1] 10
[1] 11
[1] 12
[1] 13
[1] 14
[1] 15
[1] 16
[1] 17
[1] 18
[1] 19

> for(i in 1:10) { print(.Call("simpleCall")) }

[1] 20
[1] 21
[1] 22
[1] 23
[1] 24
[1] 25
[1] 26
[1] 27
[1] 28
[1] 29

Seems ok ?

-- 
Michele Alzetta


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._