Hello, I have a question on how to handle R objects in C. I have spent a lot of time on it but I still can not figure it out. My situation is as following. I have already had C++ code for a genetic algorithm. The genetic algorithm need function evaluations. And the function I am going to use includes matrix inverse and other matrix manipulation. As you know, doing matrix manipulation is hard by C++ but is much easier by R. What I want to do is to use R to call C subroutine (genetic algorithm), but in the C code, let R help C do matrix manipulation. So I need use .Call instead of .C. I got some information on it from website (http://lib.stat.cmu.edu/R/CRAN/doc/manuals/R-exts.pdf), but it is hard to read and understand. I also read the introduction to the .C interface to R which you told me, but it is not the same situation as what I have. I have another problem. I don?t know how to put a lot of C functions together when we use .C or .Call. This is different from the C code itself. In C code itself, we have main() function, list several functions? definitions outside of the main(), before the main(), we need add those functions? declaration. I don?t know how to range those functions if we want to use R to call C. If all of these questions need take you a lot time to explain, would you please give me some examples which you used before. Thank you very much. Best wishes, Wen ------------------------------------ Wen Wan Department of Statistics Virginia Polytechnic University 403-D Hutcheson Hall Blacksburg, VA 24061-0439 Email: wenw at vt.edu Phone: (540)922-2496 Fax: (540) 231-3863