Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

objcomment question

rahzan
New Contributor I
1,441 Views
What is the effect of the objcomment below:
module Thislibrary
!Dec$ Objcomment: 'ThisLibrary.lib'
...
end module
Where the module is compiled into a static lib and the string in the objcomment is the library name itself.
reason I ask:
I have a library which has this in it, presumably so that it becomes a general purpose lib and not needed on the compile command. The library has been compiled on another pc and moved to a different project and copied in the lib path. But hwile the mod file is recognized, the linker acts as if it cannot find the lib file at all.
any hints will be appreciated.
0 Kudos
9 Replies
Steven_L_Intel1
Employee
1,441 Views
The effect is as if ThisLibrary.lib was added to the list of objects/libraries on the linker input property page. The linker will search its normal library paths to find the file.
0 Kudos
rahzan
New Contributor I
1,441 Views
Thanks,
What you say is almost identical to what the help files say.But it is not clear enough for the standard issue dummy.
1. Is the purpose so that if there are conflicting routines in differnt libraries, to give one library precedence, correct?
2. If the objcomment name is the SAME as the library name itself, the objcomment does absolutelynothing, correct?
3.If none of theroutines in the objcomment lib are found in the default libraries, the directive is moot to the final project. correct? (I suppose this is the same as question1)
4. Any idea whymy lib file is being totally ignored by a command line compile of a dll which uses the lib?
I say ignored because every single call to routines in the lib file come up as unresolved, linkerr2001. Also I have verified using dumpbin that all these routines are in fact in the lib.
I've tried putting the lib&mod file in the same folder as the working directory, as well as DF98lib.
The mod file seems to be found withuot trouble, which is why I suspected the objcomment.
'd Appreciate any further hints.

Message Edited by Rahzan on 02-10-2005 11:14 AM

Message Edited by Rahzan on 02-10-2005 11:22 AM

0 Kudos
Steven_L_Intel1
Employee
1,441 Views
1. There is no precedence involved. It's just another library name added to the list that the linker looks for. You don't have explicit control over which order the libraries are looked for.

The purpose is to say "If you use me, you also need this other library".

2. It makes no sense for an objcomment in a library to reference the same library.

3. No - the linker will complain if it can't find the library, just as it would if you listed it on the Linker properties page

4. The objcomment will be seen only if something forces the object module containing it to be referenced from the .lib. For example, if you have module procedures, the code for those is in the .obj inserted. But just having the objcomment in the library with nothing referencing the object module will do nothing. This latter is probably your issue.
0 Kudos
rahzan
New Contributor I
1,441 Views
Real sorry to be dense, but at least you verified impression #2.
1. Your statement "If you use me, you also need this other library". makes good sense, except that if he library is in the same folder or on the lib-path then objcomment is not needed at all. correct?
2. I just can't follow what you said in #4 above (I do have module procedures).Can you give a psuedo code example?
I am having trouble with this one library on one pc. It seems to work ok on another pc. I just can't figure out why the lib file is not being seen. It seems that objcomment has nothig to do with my problem.
Or I can give a more detailed description of the 2-3 files that are invovled, if that is easier to look at.
Many thanks.
Tim
0 Kudos
Steven_L_Intel1
Employee
1,441 Views
It doesn't matter if the other library is in the same folder. The objcomment references a library filename, not a path. If the linker is not told to search a given library, it won't. OBJCOMMENT is one of many ways to tell the linker to search a library.

What is the exact error you are seeing?
0 Kudos
rahzan
New Contributor I
1,441 Views
Module A !is compiled into a static lib called "A.lib"& placed on the LIB path
!dec$ objcomment lib:'A.lib' ! this we decided is immaterial
Module B !is compiled into a dll
use A
B compiles and produces .lib and .exp files butgives a link2001 (unresoved external)error on ANY/ALL calls to routines in A.
If I insert objcomment lib 'A.lib' in module B it seems to go ok.
though I never recall having to do this as long as A.lib was in DF98LIB.
Thanks again for your patience.
0 Kudos
Steven_L_Intel1
Employee
1,441 Views
Ok. The objcomment in A would be seen only if the .obj created when A was compiled is pulled in when B is linked.

The location of A.lib is immaterial if nothing tells the linker to look for it. There are lots of libraries in DF98LIB that are not referenced in the typical link.
0 Kudos
rahzan
New Contributor I
1,441 Views
whoa, I assumed with command line compilation the LIB path counts for something. Is that not true??
In the example above B.dll is compiled on the commandline.
0 Kudos
Steven_L_Intel1
Employee
1,441 Views
The LIB environment variable tells the linker what folders to look in when it wants to look for a library. It does not tell it which libraries to look for.
0 Kudos
Reply