- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok - glad that you found a solution that works for you.
![](/skins/images/D2683F18326913BBA0436CB7114DD569/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page