Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

unresolved external symbol

MAURICE_J_
Novice
478 Views

Hi,

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

Jean

0 Kudos
3 Replies
Steven_L_Intel1
Employee
478 Views

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.

0 Kudos
MAURICE_J_
Novice
478 Views

Hi Steve,

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 !!

Thanks again

Jean

0 Kudos
Steven_L_Intel1
Employee
478 Views

Ok - glad that you found a solution that works for you.

0 Kudos
Reply