From vioravis at gmail.com  Mon May  9 10:49:36 2011
From: vioravis at gmail.com (vioravis)
Date: Mon, 9 May 2011 01:49:36 -0700 (PDT)
Subject: [Rd] Fortran Symbol Name not in Load Table
Message-ID: <1304930976028-3508719.post@n4.nabble.com>

I am trying to call a FORTRAN subroutine from R. is.loaded is turning out to
be TRUE. However when I run my .Fortran command I get the following error:

Error in .Fortran("VALUEAHROPTIMIZE", as.double(ahrArray),
as.double(kwArray),  : 
  Fortran symbol name "valueahroptimize" not in load table


I have given the FORTRAN declaration below:

subroutine VALUEAHROPTIMIZE(AHR,    &
        KW,    &
        min_IHR_delta,  &
        max_AHR_error,  &
        AHR_out,   & !! Output AHE array
        IHR_out,   & !! Output IHR array
        Errors_out)
  ! Expose subroutine my_function to users of this DLL
  !DEC$ ATTRIBUTES
DLLEXPORT,C,REFERENCE,ALIAS:'VALUEAHROPTIMIZE_'::VALUEAHROPTIMIZE
 
  ! Body of my_function
 
  Implicit None
 
  Integer *4  IERR, iSum
  DOUBLE PRECISION min_IHR_delta, max_AHR_error
  logical switch_AHR_tuner
  character * 512 AHR_tuner_FilePath
 
  !!DOUBLE PRECISION  AHR(500), kW(500)  !! Initial Array for reading
Namelist
  
  DOUBLE PRECISION  AHR(*), kW(*)  !! Initial Array for reading Namelist
  DOUBLE PRECISION  AHR_out(*), IHR_out(*)
  integer Errors_out(*)


The R code I tried using is given below:

ahrArray <- runif(147)
kwArray <- runif(147)
outputAHR <- c(rep(0,11*11))
outputIHR <- c(rep(0,11*11))
outputError <- c(rep(NA,11))

dyn.load("my_function.dll")
is.loaded("VALUEAHROPTIMIZE")

[1] TRUE

> .Fortran("VALUEAHROPTIMIZE",
          as.double(ahrArray),
          as.double(kwArray),
          as.double(0.0005),
          as.double(50000),
          as.double(outputAHR),
          as.double(outputIHR),
          as.integer(outputError))

Can someone please help me with how to fix this issue? Thank you.

Ravi

--
View this message in context: http://r.789695.n4.nabble.com/Fortran-Symbol-Name-not-in-Load-Table-tp3508719p3508719.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] Fortran Symbol Name not in Load Table
vioravis