[R] weird behaviour when calling c++

Francisco J Molina fjmolina at ams.ucsc.edu
Wed Sep 24 04:59:03 CEST 2003

I am using 1.7.1 in a PC ( redhat 9, linux )

I created a subroutine in C++, mySubrutine, to be used in R. To debug this
subroutine I have a main routine in C++ that calls mySubrutine. The only thing main () does is to provide mySubrutine with its
(this is the easiest way for me to debug subroutines written in
C++ and intended to be used in R ).

I also have a version of the same program in R: an R script that provides
mySubrutine with its arguments. 

When I run the C++ version in gdb I do not have any problem, every time I
run it I get the result ( the same result ). 

The R script calls mySubrutine through .( ) C. Sometimes it gives me the 
same result I get in the C++ version; sometimes it freezes. This even
happens if I execute the script several times in a row ( I use C-c when it
freezes )
Any idea?

I am using  new and delete in mySubrutine, but I guess this should not be
any problem.

P.S: The first thing the R script executes is rm ( list = ls ( )).
     To use dyn.unload does not make any difference.
Thank you.

More information about the R-help mailing list