BLOCK DATA in static library

BLOCK DATA in static library

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?

14 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Thanks, that worked! I don't know why I didn't think of that - thanks again...

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

EXTERN

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

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.

Steve - Intel Developer Support

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

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.

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.

Steve - Intel Developer Support

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

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.

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?

Yes, it was fixed. Do you have an EXTERNAL in the main program that names the BLOCK DATA subprogram name?

Steve - Intel Developer Support

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today