- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
In my code development, I need to build some source code into a library AA and link this librarywith another code BB. Everything works all right. But I noticed that there were multiple definitions in AA and BB when I do the linking.
For example, I have a module file CC which is used in building AA library. Now when I link BB with library AA, I have the same module file CC in BB. IVF compiles and links AA and BB without any warning.
I am wondering whetherthisis normal. Which CC is used in AA and BB? In my case, the module file CC happened to be the same when building AA and BB. What about module file CChave different content (but with the same module name) in AA and BB? Which CC is used in AA and BB?
I hope I have made myself clear about my question.
Thanks,
Haifeng
In my code development, I need to build some source code into a library AA and link this librarywith another code BB. Everything works all right. But I noticed that there were multiple definitions in AA and BB when I do the linking.
For example, I have a module file CC which is used in building AA library. Now when I link BB with library AA, I have the same module file CC in BB. IVF compiles and links AA and BB without any warning.
I am wondering whetherthisis normal. Which CC is used in AA and BB? In my case, the module file CC happened to be the same when building AA and BB. What about module file CChave different content (but with the same module name) in AA and BB? Which CC is used in AA and BB?
I hope I have made myself clear about my question.
Thanks,
Haifeng
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If module CC has the same symbols in both libraries, then whichever library is seen first will resolve references and the module from the other library will be unused. If the two instances of module CC have different symbols, and there are references to symbols such that both versions of CC are required to satisfy the references, then you'll get a linker error (unless the linker option /force:multiple is specified.)
The compiler can't check this, and having two modules of the same name in a Fortran program is not valid Fortran.

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