Hi Simon, thanks for your information, I have tried to set "R_CStackLimit = (uintptr_t)-1" after Rf_initialize_R, but i don't know which Rf_initialize_R, because i found several in my source code. I had tried to set it in some place, but it still don't work. Strangely, i add "R_CStackLimit = (uintptr_t)-1" to my own application after init_R(argc, argv), it print new error info. The detail as follow: I firstly tried to add "R_CStackLimit = (uintptr_t)-1" to /R-2.9.0/src/main/Rmain.c , and then recompile R using --enable-R-shlib, but it did't work.
Then i added it to "/R-2.9.0/src/unix/Rembedded.c", then compile it as above, it also didn't work. I finally added it to my own application code after "init_R(argc, argv)"(you can look at my previous mail), it didn't give me the error information, but this time it inform me the error info: Error: could not find function "print" (I use PROTECT(tmp = mkString("{print(lh)}")) in my application's code) so Simon, can you give me more advice, or you can give me a simple code using R in thread. Realy appreciate you help! ?*********************** ?Bin?Dong ?BUAA,?Beijing?PR?China ?goo...@126.com ?*********************** ÔÚ2009-05-19?18:23:08£¬"Simon?Urbanek"?<simon.urba...@r-project.org>?дµÀ£º > >On?May?19,?2009,?at?4:30?AM,?goon83?wrote: > >>?Hi?everyone! >>???I?meet?one?problem?when?embedding?R?in?C?code,?when?I?run?the?the?? >>?R?code?in?one?child?thread?, >>???it?always?print?error?info: >>????Error:?C?stack?usage?is?too?close?to?the?limit >> >>???I?also?try?to?set?R_CStackLimit?=?(uintptr_t)-1?to?disable?the?C?? >>?stack?check?as?the?R-exts?doc?say, >>???but?it?still?does?not?work,?the?error?info?still?exist. >> > >That?is?the?way?to?do?it?(and?other?project?use?it?successfully)?-?the?? >fact?that?it?doesn't?work?means?that?you?probably?do?it?at?the?wrong?? >place?(you?must?set?it?*after*?Rf_initialize_R). > >Cheers, >Simon > > >>???Besides?it?is?interesting?that?if?i?put?the?R?code?in?the?main?? >>?thread(don't?create?any?thread),?it?work,??and?the?E-exts?doc?say?? >>?that??"Embedded?R?is?designed?to?be?run?in?the?main?thread,?and?all?? >>?the?testing?is?done?in?that?context."?so?i?wonder?is?it?that?? >>?Embedded?R?can?not?run?in?the?child?thread?? >> >>???so,?can?anybody?give?some?help?or?suggestion?about?this?problem, >>???any?response?will?be?appreciated,?tks?in?advance. >> >>?*********************** >>?Bin?Dong >>?BUAA,?Beijing?PR?China >>?goo...@126.com >>?*********************** >> >>???ps:?my?code,?system?info?and?error?information?list?behand >> >>???----------------------------- >>???1,?my?example?code?lists?here: >>???----------------------------- >>???#include?.... >> >>???void?*ts_thread(){ >>?????????SEXP?e,?tmp; >>?????????int??hadError; >>?????????int?argc?=?0; >>?????????char?*argv[1]; >>?????????ParseStatus?status; >> >>?????????init_R(argc,?argv); >> >>????????PROTECT(tmp?=?mkString("{print(lh)}")); >>????????PROTECT(e?=?R_ParseVector(tmp,?1,?&status,?R_NilValue)); >>????????PrintValue(e); >>????????R_tryEval(VECTOR_ELT(e,0),?R_GlobalEnv,?&hadError); >> >>???????UNPROTECT(2); >>???????end_R(); >>?} >> >>?int?main(int?argc,?char?*argv[]){ >>????pthread_t?th1; >>????int?iret1; >> >>????iret1?=?pthread_create(&th1,?NULL,?ts_thread,NULL); >>????pthread_join(th1,?NULL); >>????printf("Thread?1?return:%d\n",?iret1); >> >>????return?0; >>?} >>?----------------------------------- >>?2,?My?os?and?compiler?is: >>?----------------------------------- >>?Linux?debian?2.6.26-1-686?#1?SMP?Sat?Jan?10?18:29:31?UTC?2009?i686?? >>?GNU/Linux >>?gcc?version?4.3.2?(Debian?4.3.2-1.1) >> >>?----------------------------------- >>?3,?the?error?info: >>?------------------------------------ >>?g...@debian:~/library/R-source/R-2.9.0/tests/Embedding$?./Rar >>?Error:?C?stack?usage?is?too?close?to?the?limit >>?Error:?C?stack?usage?is?too?close?to?the?limit >> >>?R?version?2.7.1?(2008-06-23) >>?Copyright?(C)?2008?The?R?Foundation?for?Statistical?Computing >>?ISBN?3-900051-07-0 >> >>?R?is?free?software?and?comes?with?ABSOLUTELY?NO?WARRANTY. >>?You?are?welcome?to?redistribute?it?under?certain?conditions. >>?Type?'license()'?or?'licence()'?for?distribution?details. >> >>?R?is?a?collaborative?project?with?many?contributors. >>?Type?'contributors()'?for?more?information?and >>?'citation()'?on?how?to?cite?R?or?R?packages?in?publications. >> >>?Type?'demo()'?for?some?demos,?'help()'?for?on-line?help,?or >>?'help.start()'?for?an?HTML?browser?interface?to?help. >>?Type?'q()'?to?quit?R. >> >>?expression({ >>????print(lh) >>?}) >>?Error:?C?stack?usage?is?too?close?to?the?limit >>?Thread?1?return:0 >>?------------------------------------------ >> >> >>? [[alternative?HTML?version?deleted]] >> >>?______________________________________________ >>?r-de...@r-project.org?mailing?list >>?https://stat.ethz.ch/mailman/listinfo/r-devel >> >> > [[alternative HTML version deleted]]
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel