Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Comunicados
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.

BLOCK DATA in static library

rocketdata
Principiante
1.933 Visualizações
I created a Static Library with a bunch of Fortran routines, and it contains some BLOCK DATA subprograms. When I link the library with my Main program, the BLOCK DATAs don't seem to get included properly (and my program dies). Is there a way of forcing the BLOCK DATAs to be included in the Static Library so that when the main program is created, the BLOCK DATA information gets included properly?
0 Kudos
13 Respostas
james1
Principiante
1.933 Visualizações
Try indicating that the block data is external in your code with "external block_dataname" to ensure that the linker knows to go looking for it.

James
rocketdata
Principiante
1.933 Visualizações
Thanks, that worked! I don't know why I didn't think of that - thanks again...
douglas_a_pouk
Principiante
1.933 Visualizações

I have the same problem - a BLOCK_DATA (called ATMOS) defined in a static library with another SUBROUTINE that externs it like this

EXTERN

douglas_a_pouk
Principiante
1.933 Visualizações

I have the same problem - a BLOCK_DATA (called ATMOS) defined in a FORTRAN source compiled into static library with another SUBROUTINE that externs it like this:

EXTERNAL ATMOS

I also tried:

EXTERNAL BLOCK DATA ATMOS

When I run my program the common block initialized by the ATMOS block data unit is empty. All data is ZERO.

The EXTERN statement does not seem to be helping here - are there more details I might be missing? I am linking these FORTRAN libraries from a Win32 Console Application - not a FORTRAN console application - maybe that is the problem?

Thanks if anyone can help :)
Doug
Steven_L_Intel1
Funcionário
1.933 Visualizações
EXTERNAL ATMOS is what you want. However, there has been a bug in Intel Visual Fortran 8 where this doesn't work - I'm not sure if it's fixed yet.
douglas_a_pouk
Principiante
1.933 Visualizações

Thanks Steve -I don't have the latest patches installed - I'll give that a try. I cannot get it to link any which waywith IVF 8.0 out of the box - so hopefully it is fixed in a patch. I'll post a message when I get the patch installed.

cheers

douglas_a_pouk
Principiante
1.933 Visualizações
Same result with the latest compiler - the BLOCK DATA object contained in a static library does not get found by the linker.
This behaviour worked perfectly with the Compaq Visual Fortran 6.6. So far I am a little disappointed with my testing of IVF8.0 after using CVF6.6 with great success for a year.
I will report this problem to Intel if I can figure out how.
Steven_L_Intel1
Funcionário
1.933 Visualizações
The bug isn't fixed yet.
A workaround is this. Select Project..Properties..Link..Input. Under "Force Symbol References", give the name of your BLOCK DATA in uppercase and withtwo preceding underscores, for example, __ATMOS.
I had not realized until I looked at this again that the symbol for the BLOCK DATA has two underscores. I think that is wrong and will report it.
hansr
Principiante
1.933 Visualizações
Is this bug fixed now with IF 8.21?
In one program of me it seems to work totally without
"Force Symbol References" an double-Underline-Blockdataname.
Hans
aliho
Principiante
1.933 Visualizações
I remember that this problem occured in Microsoft Fortran Powerstation 1 and was resolved by adding a void subroutine (ATMOS _BLOCK_DATA_INIT for example) in the source file containing the block data and call it from main.
richman32
Principiante
1.933 Visualizações
Has this issue been fixed? I've having a similar problem with a static library I am trying to compile using Intel Fortran 9.1 in the Visual Studio .NET 2003 IDE. The data initialized in the block data unit does not seem to be available when the library routines are called. How should this work?
Steven_L_Intel1
Funcionário
1.933 Visualizações
Yes, it was fixed. Do you have an EXTERNAL in the main program that names the BLOCK DATA subprogram name?
richman32
Principiante
1.933 Visualizações
I have tried it with the EXTERNAL and it has not seemed to make any difference. I don't really have a main program, just a set of library subroutines. I've tried adding the BLOCK DATA subprogram name to an EXTERNAL statement in the subroutine where I need to reference the common data, but it doesn't seem to initialize.
Responder