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

Runtime problem with static library

Motaz
Beginner
804 Views

Hello,

 

I have a large set of subroutines that are part of a scientific simulation that run correctly as intended when compiled as one project. when the same set of subroutines are combined into a static library, and this library is linked with the main program some variables are overwritten which causes the program to not run correctly. What can be a possible reason for this issue?

 

Thank you in advance

 

 

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
787 Views

Most likely is an error in your program that is using out-of-bounds memory to reference something. The different linking changes the memory layout of the code, so what may have been harmless before is no longer harmless. As a first step, rebuild with all run-time checks enabled, and also make sure that generated interface checking is enabled (it is by default in a Windows Debug project.)

0 Kudos
Motaz
Beginner
752 Views

Many thanks Steve for the prompt answer.

 

I tried this and found that the checks were all enabled already. However, I still get the same issue of overwriting variables with no run time error messages.

 

Could there be other linking issues?

 

Thanks again 

Motaz

0 Kudos
andrew_4619
Honored Contributor III
739 Views

Steve's comments still stand, there are many such errors that the compiler checks do not pick up. Does your code have standards compliance checking BTW? I have personally found that eliminating those not standard things 'that have always worked'  has flushed out loads of hidden issues and unexpected behaviours. That can be a big job!

0 Kudos
Reply