- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This little program, which I think is "legal":
Has that symbol been "mangled" correctly? I see _FRUITS_mp_NAMES in the symbol table which looks more like what I'd expect.
If I comment out the lines marked "#A" the link suceeds.
Thanks for any advice,
IanH
[fortran]MODULE Fruits
IMPLICIT NONE
PRIVATE ! #A
PUBLIC :: Get ! #A
CHARACTER(*), PARAMETER :: names(3) = [ &
'Apple ', &
'Orange ', &
'Mango ' ];
CONTAINS
FUNCTION Get(i) RESULT(s)
INTEGER, INTENT(IN) :: i
CHARACTER(LEN_TRIM(names(i))) :: s
!****
s = names(i)
END FUNCTION Get
END MODULE Fruits
PROGRAM WheresThatbLinkingConstantGone
USE Fruits
IMPLICIT NONE
!****
WRITE (*, "('Eat the tasty ',A)") Get(1)
END PROGRAM WheresThatbLinkingConstantGone
[/fortran] when compiled and linked using 11.1.065 with /warn:all /check:all /stand:f03 results in an unresolved external symbol error for _FRUITS_GET_mp_NAMES in _MAIN__. Has that symbol been "mangled" correctly? I see _FRUITS_mp_NAMES in the symbol table which looks more like what I'd expect.
If I comment out the lines marked "#A" the link suceeds.
Thanks for any advice,
IanH
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error message suggests that when the compiler sees the reference to "names(i)" on Line-12 it has forgotten the definition of "names" as a parameter array on Line-5, possibly as a result of a misapplication of host-association rules, specifically the attribute PRIVATE.
If "names" were undeclared, the reference to it on Line-12 would be compiled as a call to an external function "names" with argument "i", as a result of implicit typing rules coming into play.
If "names" were undeclared, the reference to it on Line-12 would be compiled as a call to an external function "names" with argument "i", as a result of implicit typing rules coming into play.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. It's not that the compiler "forgot" but it is definitely confused. I'll report it. Thanks. Issue ID is DPD200155685.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fixed in version 12.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page