Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Error on creating a dll

Dwijendra_Sharma
Beginner
665 Views
Help needed to resolve this, it's really frustrating.

When I link the included project to make a DLL file, a Warning LNK4217 message is displayed. This relates to the DLLexport command of a common block that is defined in a Module named GRAPHICS_BLOCK2. If I move the contents of this module into my subroutine, the error message does NOT appear.

In my source code that I have converted from Compaq Fortran, this module is accessed by many subroutines. Most of the time LNK4049 is the error that comes up instead of LNK4217. How can I eliminate these messages without repeating this code in all my subroutines?
0 Kudos
3 Replies
Steven_L_Intel1
Employee
665 Views
The title of your post says "Error" but I see a "Warning". Is something I don't see preventing the DLL from building?

The 4217 warning will occur if your DLL contains a module that DLLEXPORTs something and you USE the module in the DLL. When you use a module that has a DLLEXPORT, that turns into a DLLIMPORT. The linker is saying "you told me that /GRAPH/ was DLL imported but I see the object code for it right here." You can ignore this, or if it REALLY bothers you, add /ignore:4217 to the linker options.

The reason the compiler does this is partly because MSFPS did and partly because it's a good idea. It allows you to take the same .mod file you generate when building the DLL and using it for the consumers of the DLL. Otherwise you'd need to build two different versions, one with DLLIMPORT and one without.

LNK4049 is a variant of this same warning and can also be ignored. I think which you get depends on the order the linker sees the objects.
0 Kudos
Dwijendra_Sharma
Beginner
665 Views
So, I can assume that the dll created is a genuine one and not going to cause me any problems.
0 Kudos
Steven_L_Intel1
Employee
665 Views
Correct.
0 Kudos
Reply