[R] weird behaviour when calling c++

Liaw, Andy andy_liaw at merck.com
Wed Sep 24 14:15:05 CEST 2003


This is sort of like calling up an auto mechanic and ask "My car just won't
start.  Can you fix it?"  The answer is almost surely "yes", but not without
looking at the car (or at least get answers on quite a few questions)!
Showing us the code would be a start.

Since you can use gdb to debug the code when run as stand-alone, why not try
running R under gdb and see if you can figure out the problem?

Andy

> -----Original Message-----
> From: Francisco J Molina [mailto:fjmolina at ams.ucsc.edu] 
> Sent: Tuesday, September 23, 2003 10:59 PM
> To: r-help
> Subject: [R] weird behaviour when calling c++
> 
> 
> 
> 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 arguments 
> (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.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>




More information about the R-help mailing list