From simon.urbanek at r-project.org  Fri Aug 20 18:48:36 2010
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Fri, 20 Aug 2010 12:48:36 -0400
Subject: [Rd] segfault in embedded r after call to repldlldo1
In-Reply-To: <4C6EA9FC.7040604@zib.de>
References: <4C6EA9FC.7040604@zib.de>
Message-ID: <BE01107C-81D0-496D-BA1F-745A9ECD3A3B@r-project.org>


On Aug 20, 2010, at 12:14 PM, Carl Martin Grewe wrote:

> Dear R developers,
> 
> i've got a question concerning an embedded R instance. I called the initialization routines as seen in the "writing extensions" guide (Rf_initialize, setup_Rmainloop and R_ReplDLLinit). I also changed the function callback pointer of readconsole and writeconsoleex to my local functions.
> 
> when i call mainloop there is no problem and the commands are evaluated as expected. because i don't want R to run in an own thread and my app should keep the control i want to use repldlldo1. within the readconsole as long as i copy commandlines containing valid R commands function to R's buffer all things are fine. but when i copy a non valid command, R singals segfault after passing the error message, that the given object is not valid. this happens in call to eval(R_CurrentExpr, rho) in repldlldo1. i tried to comapare both ways (mainloop vs. repldlldo+repldllinit) but actually cannot find a significant difference.
> 

I fear we can't help you without a reproducible example. One thing to keep in mind is that R_ReplDLLinit uses setjmp to setup the top-level context so you have to make sure you're not using any local variables that could be on the stack from R_ReplDLLdo1 as it will get lost (and function calls of course).

Cheers,
Simon


> can anyone please help me with this problem, i'm stucked with this because i don't know the inside of R and the datastructures.
> 
> 
> some additional information:
> c++, runtime loaded libR, 64-bit linux, 2.11.1 release (but also happens with 2.10.1)
> 
> look farward to hearing from you.
> 
> thanks,
> martin
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 



[Rd] segfault in embedded r after call to repldlldo1
Simon Urbanek