- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this subroutine, the compiler gives me error messages on the first two calls to KOPY.
It tells me that it has "already been used as an external." The next two calls are not flagged. Also, other routines use KOPY and are not flagged.
Why does it not treat the first two references as references to an external?
It tells me that it has "already been used as an external." The next two calls are not flagged. Also, other routines use KOPY and are not flagged.
Why does it not treat the first two references as references to an external?
================================================ integer*1 function comp(a,b) ! compares two numbers ! if a number is longer, the extra places must be zero for equality integer*4 aa(0:255),bb(0:255) integer*1 swap external kopy na=a(0) nb=b(0) if(na.gt.nb)then swap=1 else if (na.lt.nb)then swap=-1 else swap=0 endif print *,'swap=',swap if(swap.ge.0)then call kopy(a,aa) ! this if flagged call kopy(b,bb) ! and so is this one else call kopy(a,bb) !NOT flagged call kopy(b,aa) !NOT flagged endif ! longer number is always in aa minab=min(na,nb) comp=0 do i=1,minab if(aa(i).gt.bb(i))then comp=1 exit else if(aa(i).lt.bb(i))then comp=-1 exit endif end do print *,'comp=',comp ! if unequal length, see if any extra places are zero ! if any are not zero, aa is greater if(comp.eq.0 .and. swap.ne.0)then do i=minab+1,na if(aa(i).ne.0)comp=1 end do end if ! finally, change result if they were swapped if(swap.lt.0)comp=-comp return end
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your Web site removed the CRs and tabs, unfortunately.
Anyway, when I trim down the code, I dsicovered that I had forgotten to type the input aguments. But I still don't see why I got the misleading error message.
Anyway, when I trim down the code, I dsicovered that I had forgotten to type the input aguments. But I still don't see why I got the misleading error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fixed the editing.
The error message highlights A and B as the problem symbols, not KOPY. You have references to a(0) and b(0) earlier, and since these are not declared as arrays, the compiler assumes they are external functions. But if you want to pass an external procedure as an actual argument, an explicit interface or EXTERNAL is required. I agree that the message could be better.
Adding the missing declarations of A and B fixed it.
Steve
The error message highlights A and B as the problem symbols, not KOPY. You have references to a(0) and b(0) earlier, and since these are not declared as arrays, the compiler assumes they are external functions. But if you want to pass an external procedure as an actual argument, an explicit interface or EXTERNAL is required. I agree that the message could be better.
Adding the missing declarations of A and B fixed it.
Steve

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