Topic: making dll to use in R
Hello,
I need to call Fortran subroutines into a 64-bit R through dll files. My main goal is to share my research-codes through dll files, so that practitioners can use them. To create a 64-bit dll, I am currently using the SimplyFortran trial version. I have created the dll in SimplyFortran, but the dll doesn’t work in R. I am very new to SimplyFortran and not sure if I am making any mistakes. Here is a (f77) sample code that I am trying to use in R:
subroutine add(sm,a,b)
implicit none
integer sm, a, b
sm = a + b
return
end
To create the dll in SimplyFortran, I save and open the ‘An empty static library project’ and follow the steps:
(1) Click on Project > Add files(s)… > choose the subroutine add.f90
(2) Project > Options… > Target Name: add.dll
(3) Build > Build now!
Here is how I load the dll in R:
dyn.load("C:/Users/Sam27/Desktop/projects/add.dll")
Here is the error msg:
Error in .C("add_", as.integer(-999), as.integer(10), as.integer(15)) :
C symbol name "add_" not in load table
I see that similar problems have been discussed, but I have not been able to solve mine. Would you please give me helpful comments? I will really appreciate it.
Best regards,
Sam