Skip to content
Prev 15507 / 63424 Next

Compiling "R Embedded" examples

Your suggestion to use Rmain.c led to the solution.

The compilation of Rmain.c worked ok. I had a look at Rmain.c and found this reference to MAIN__

/* Declarations to keep f77 happy */
int MAIN_(int ac, char **av)  {return 0;}
int MAIN__(int ac, char **av) {return 0;}
int __main(int ac, char **av) {return 0;}

Adding those lines to Rtest.c did the trick.

I am still puzzled by this problem. The fortran compiler I was using is g77 from gcc3.3.2.

$ g77 -v
Reading specs from /app/gcc_3.3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs
Configured with: ../configure --prefix=/app/gcc_3.3.2 --with-local-prefix=/app/gcc_3.3.2 --enable-threads --enable-version-specific-runtime-libs : (reconfigured) ../configure --prefix=/app/gcc_3.3.2 --with-local-prefix=/app/gcc_3.3.2 --enable-threads --enable-version-specific-runtime-libs
Thread model: posix
gcc version 3.3.2

Anyway, it works now. Thanks a lot for your help!

Laurent




-----Original Message-----
From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk]
Sent: 22 March 2005 16:52
To: Mauron Laurent (KETR 31)
Cc: 'r-devel@stat.math.ethz.ch'
Subject: RE: [Rd] Compiling "R Embedded" examples
On Tue, 22 Mar 2005, Mauron Laurent (KETR 31) wrote:

            
(Which problem is not described in this message and the stated URL is 
invalid.  Searching suggests it is related to MAIN__.)
No.  Only R.bin is in any way similar to the embedded examples: tcltk is 
run from R, not R from tcltk.

Solaris 8, gcc 3.4.3 works for me.

Note that MAIN__ is defined in Rmain.c, and that is part of R.bin and not 
libR.so.  You could try copying it is to Rtest.c to see if this helps.

What you have not told us is the Fortran that you are using.  That is 
likely to be the clue.  Try a current gcc AND g77 -- gcc is a Compiler 
Collection, not just a C compiler.