- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I link my library I get many warnings LNK4006 "NULL_IMPORT_DESCRIPTOR already defined in kernel32.lib(KERNEL32.dll); will be ignored".
The warnings seem to come from user32.lib, gdi32.lib, winspool.lib, comdlg32.lib, advapi32.lib, shell32.lib ...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do you mean by "When I link my library..."? Are you building a DLL? An EXE?
You need to provide, at a minimum, the linking command that produced the errors/warnings. You mention Error 4221 in the title but nowhere in the body of your post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am building a .lib-file.
Each LNK4006 is followed by a LNK4221.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't add DLL import libraries as inputs to your static library build. You should not be "linking" a static library. What is happening is that you have the "Include dependent libraries" option on (I forget the exact spelling) and you have named various DLL import libraries as inputs for a static library build. Take those out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you mean, that I have to leave the field "librarian - general - additional dependencies" in the options empty?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Martin B. wrote:
Do you mean, that I have to leave the field "librarian - general - additional dependencies" in the options empty?
Yes, if you are referring to one of the umpteen panels of the project properties inside Visual studio. The problem with answering such questions is that there are plenty of other options and settings in those panels that you may have set and may affect the answer to your questions, and you have not stated anything about those options and settings.
The advice that Dr. Fortran most recently gave in the last paragraph of https://software.intel.com/en-us/forums/topic/560615#comment-1829821 is well worth following.
Usually, when a static library is built, it is simply an archive of all the input .OBJ files, plus a dictionary/directory of the symbols and archive members. It follows that there will be plenty of references to unresolved symbols. Those symbols may be from the Fortran runtime, or the system libraries such as MSVCRT.DLL, KERNEL32.DLL, etc., or from additional libraries such as MKL, IMSL, etc. These symbols will be resolved when you link an application with the static library that you are now building.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Typically for a static library build, you have no additional dependencies. The exception would be when you are building multiple static libraries and want to have one include all the others. What you seem to have done is name several Windows DLL import libraries. While these do have the .lib file type, they are NOT static libraries and can't be included in yours. The user of your library would need to link to the appropriate libraries. By default in a static library build, the Fortran compiler adds "object comment directives" that name the Fortran run-time libraries to be linked against. The linker will process these when the executable program is linked.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page