Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Including library problem

h-faber
Beginner
490 Views
Hi @all,
what I already have working:
I created a static library tools.lib which contains several helpful functions, such as the rounding I mentioned in another thread. So there are functions and subroutines.
I use this library in the project dependencies successfully with CALL ROUND(...) etc. where ROUND is in the static library.
Now i try to include some general variable declaration and some common block like

REAL AFWR COMMON/AUSMA1/ADA,ADAD,ARWDA,AZFL,AWFL,AZFR,AWFR,AB,ABN,ARWR,ARWL,

* ATOB,ARWV,AFR,AFPL,DAQUW,ADFA,ADK,ADLA,ALK,ADN1,ADN2,

* ADEE,ABE2,ADFR,AFBL,AFWL,AFBR,AFWR

COMMON/AUSMA2/APDAD,ANS

But when I try to include this file, same dependency as the tools.lib used, those include files can not be opened. Although they are definitely in the library.

What am I doing wrong, or doesn't this work with dependencies without functions and subroutines?

Harald

0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
490 Views
I apologize in advance if I misread what you're doing; based on my reading, the answer is:

INCLUDE is a mere text-substitution directive, and the file it refers to is looked for in pre-compilation stage. That means that if you do

INCLUDE "whatever.fd"

the compiler looks for file whatever.fd on the disk in its search path -- having it "precompiled" in a .lib won't do. Even if you did include "whatever.fd" while building the library, that merely means that the linker will preserve global symbol "_AUSMA1" (the name of the common block) that is "defined" in the .library, but not its contents as well. Thus, you still have to have the file "whatever.fd" at hand while building the .exe file -- it will tell the compiler that there is a common block named /AUSMA1/ and that it "contains" variables ADA, ADAD etc.

The situation is not the same as with routines; basically, to refer to a routine, you only need its name and number of arguments, which is what gets "exported" from the .obj/.lib file. But the include file does not get "automagically" wrapped into the library.

Jugoslav
0 Kudos
h-faber
Beginner
490 Views
Hi Jugoslav,
thanks for your answer, but I have to apologize.
Now everything is fine, just solved this issue 5min ago. The problem was that after the include statements there is a common block whichwas "closed"with END. Therefore after this line there was a lot of trouble and of course all the variables which have been included before this END, suddenly disappeared. Sometimes bugfixing and working with old, foreigncode can annoy... :smileymad:
0 Kudos
Reply