I have been hired (I am a freelance) to 'convert' functions written in a strange and very slow language named R into FORTRAN. Some works have been done previously and we have a large amount of FORTRAN DLLs having each only one subroutine. And in fact a lot of versions. I want to build only one DLL with all the subroutines in it. My problem is that these subroutines must be called by R and also by other subroutines in the same DLL.
For a subroutine to be called by R I must add these three lines of attributes :
!DEC$ ATTRIBUTES DLLEXPORT :: reglin
!DEC$ ATTRIBUTES ALIAS:"reglin_" :: reglin
!DEC$ ATTRIBUTES C,REFERENCE :: reglin ! Pour "R"
but then when I build the DLL, I get 'unresolved external symbol _reglin' on instructions call reglin in other FORTRAN routines.
Can I do something to solve this issue or must I duplicate each subroutine, one for R on the other for FORTRAN (let's say rreglin and freglin !)
Thanks in advance
You have to repeat the ALIAS directive in any Fortran routine that calls reglin. Perhaps an alternative, which I would find preferable, is to modify the R code so that it does not force Linux conventions (lowercase name and trailing underscore) on Windows. The ATTRIBUTES C,REFERENCE is probably not needed if you're also using ALIAS.
thanks for your answer.
I have already written an INTERFACE block in each routine not because it's needed but it's more easier for me to go to the beginning of a routine to look for what parameters to what routine instead of browsing the whole file. So I add ATTRIBUTES in the interface of each routine and it works well !
I think it's more easier to 'improve' (correct ?) FORTRAN than to tell R not to use underscore !!