This is not gfortran-help, but note that you are not doing this correctly. See 'Writing R Extensions' §1.2.1. The linking step needs a flag too.

Beyond that, you failed to tell us your OS, and in fact there are no such versions of gfortran (4.6.0 != 4.6). The posting guide does ask you to be accurate in your version numbers (and not to send HTML).

On 08/06/2013 14:43, Fabio Mathias Corrêa wrote:
Dears,

I am writing a code in Fortran using OpenMP directives.

When compiling the code in gfortran 4.4 does not occur any problem.

When compiling the code in gfortran 4.6, an error message appears.

In other compilers the error does not occur.


A small example.


## Code in Fortran

You declare this to be Fortran 90.

        subroutine hello()
        implicit none
        integer :: nthreads, tid
        integer :: omp_get_num_threads, omp_get_thread_num
        integer :: omp_get_max_threads, omp_set_num_threads

        print *, 'Máximo de threads', omp_get_max_threads()

        !$omp parallel
        tid = omp_get_thread_num()
        print *, 'Hello World from thread = ', tid
        print *, 'Number of threads =', omp_get_thread_num()
        !$omp end parallel
        end subroutine hello


### Compiling and testing

system("R CMD COMPILE hello.f90 FCFLAGS=-fopenmp")
system("R CMD SHLIB hello.o")

dyn.load("hello.so")

.Fortran("hello")

### Error message

/home/fmcron/Documentos/Fortran/OpenMP/exemplos/hello.so: undefined symbol: 
_gfortran_transfer_character_write



Thanks


         Fábio Mathias Corrêa


    Universidade Estadual de Santa Cruz
Departamento de Ciências Exatas e da Terra - DCET


Campus Soane Nazaré de Andrade, km 16 Rodovia Ilhéus-Itabuna
CEP 45662-900. Ilhéus-Bahia
        [[alternative HTML version deleted]]



______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to