Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8658667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:49:31+00:00 2026-06-12T15:49:31+00:00

We have a large solution in Visual Studio 2010 which comprises a Fortran exe

  • 0

We have a large solution in Visual Studio 2010 which comprises a Fortran exe and multiple Fortran and C++ static library projects:

FORTRAN EXE --> MY_LIB (C++)
--> MY_LIB_2 (C++)
--> MY_LIB_3 (Fortran)

We and have encountered a problem with the run-time performance of the EXE diminishing by about 50% after modifying a C++ static library dependency.

Everything was running fine until we referenced some additional header files in one of the C++ libs. These headers are contained in a project that does not contain any source files, only C++ header files, and therefore does not produce any compiled output of its own:

FORTRAN EXE --> MY_LIB (C++, now includes headers from headers-only project)
--> MY_LIB_2 (C++)
--> MY_LIB_3 (Fortran)

The reason that the headers-only aspect is significant is that it is not possible to set optimizations for a C++ project in Project Properties unless it contains source (.c/.cpp files) and produces some output. However, when included elsewhere, the headers will be subject to the same optimizations as the including project. We’re not doing anything in the code the disables optimizations (e.g. with pragmas).

After the change our code now runs about 50% slower. We are calling only one function in the newly included headers which carries little overhead and does not account for the slowdown. Profiling in AQTime reveals that the slowdown is consistent throughout the code.

What I believe may be causing this is optimizations being inadvertently disabled. At the point the Fortran EXE is linked, we receive a large number of C4748 warnings about optimisations having been disabled in various functions defined in the newly included headers, as well as in and other cpp files that also include them (we didn’t receive these before including the additional headers):

------ Build started: Project: FortranEXEProject, Configuration: Release Win32 ------
Linking...
   Creating library D:\Source\Release\FortranEXEProject.lib and object D:\Source\Release\FortranEXEProject.exp
Generating code
c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(620) : warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
d:\Source\CPPHeaderLibrary\header1.hpp(3231) : warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
d:\Source\CPPSourceLibrary\source.cpp(54) : warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function

All projects have optimizations enabled and are using link-time code generation (/LTCG).

Process explorer reveals that that the Fortran linker XLink.exe is calling the C++ linker, LINK.exe.

Can anyone explain what is happening here, and how to ensure that optimizations in linked C++ code are maintained in Fortran?

We are using Intel Fortran Composer XE 2011.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:49:32+00:00Added an answer on June 12, 2026 at 3:49 pm

    In the end we noticed that optimisations had been disabled in a couple of our C++ static library projects further down the call graph which included the new headers. This occurred some time before adding the new headers but clearly the performance hit only came to light when the new code was linked. Turning optimisations back on has fixed the problem; what distracted us was LINK.EXE being invoked by XLINK – it turns out that link.exe is just the windows linker – it is not C++ specific.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large-ish Visual Studio 2010 solution (~110 C# projects). One project (let's
We have a Visual Studio 2008 solution with a large number of projects in
In Visual Studio 2010 I have a large solution that contains number of .cs
We have a large number of C# projects in a visual studio solution. For
We have a large Visual Studio 2005 C++/Mfc solution, 1 project with around 1300
I have a rather large solution, which contains two documentation projects based on Sandcastle
I have a large solution which contains a mixture of C# and VB.Net projects.
I have a relatively large C#/WPF Visual Studio 2008 solution that I am trying
I am beginning work on a large Visual Studio solution, and have come across
I've got a large visual studio solution with ~50 projects. There are configurations for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.