- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If I have two subroutines in the same file, A and B, A appearing first and B calling A, there seems to be no problem resolving B's reference to A. If I have the same situation, but A and B are modules, and B uses A, B cannot find A. This is more than a minor annoyance, because even if A and B are related in the program, I need to find another file in which I can "hide" B, even though it has no logical relationship to anything else in that file. Is this a bug or a "feature"? If it is a feature, what is the rationale behind it?
Regards,
Keith
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you just have two subroutines, the linker is what needs to resolve the reference, and once it has loaded the object, it has all the symbols. Modules are processed by the compiler and the standard says that a module has to be "available" when you USE it. Forward module references in a file are not required to work, and don't in most compilers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess I misunderstand the question, but I believe I do this all the time. I.e. have function B in modB refer to function A in modA. I sometimes have to build (not a complete rebuild) such applications twice in a row because modA.mod may not exist the first time around, but it seems to work.
But then again, I probably misunderstood the question.
Walter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Walter,
I think that you have found a "workaround" to my issue. I was assuming that a .mod file would be created by the compiler for A and then be accessible to B. This is apparently not the case. Also, I think Steve misunderstood that B was making a backward, not a forward reference to A. What may be happening in the case that you describe is that the .mod for A is created the first time you compile, but the compilation of B crashed. On the second compilation, a rebuild, A was ignored because a current version already existed and this time B found it.
Thanks to both of you for your replies.
Regards,
Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keith,
Yes, this is probably what is happening.I suppose that for simple situationsthe dependency checker will make sure that the sequence of compilation is correct, but in more complex situationsthere may be no (or hard to determine?) proper sequence. Under these circumstances the repeated build can help out.
Walter
Message Edited by wkramer on 12-05-2004 11:16 AM

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