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

append source code lines to a compiled fortran code

lrego-developer
New Contributor I
1,743 Views

Hello,

I would like to include a few "ad-hoc" lines of source code to an already compiled Fortran code, can it be done? 

The idea is to introduce a few system-specific calculations to a general purpose, and much bigger, Fortran code that should not be recompiled in that particular case.

I would like to know whether there is a viable way to do it. 

Labels (3)
0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
1,720 Views

Not possible.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,652 Views

It can be done, but will take exceptional skill to do so.

In the old days (1970's) we (I and others) would patch the executables (and operating systems) using a binary editor. The general technique was to replace an instruction with a Jump instruction to unused memory, issue the replacement code (including the overwritten instruction) then Jump back. In some cases where the patch code is smaller than the old (bad) code, the patch would overlay the old code (possibly padded with NOP or Jump).

So, the answer is it is possible, but difficult.

 

IIF (if and only if) the changes can be make pre-call or post-call to the Fortran code, you may be able to encapsulate the Fortran code.

 

Jim Dempsey

lrego-developer
New Contributor I
1,522 Views
0 Kudos
Reply