Home > Archive > Fortran > December 2004 > "BLOCK DATA" blues
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
"BLOCK DATA" blues
|
|
| Michael Yoshpe 2004-12-28, 4:00 pm |
| I maintain a mixed-language (C-FORTRAN) project, using Compaq Visual Fortran
6.6C. A small C driver calls a FORTRAN subroutine, which in turn calls many
other fortran subroutines. Some of the tables in these subroutines are
initialized with BLOCK DATA construct. As long as i built a console exe
application from all files at once, everything worked fine. But recently i
decided to build a static library from all fortran routines, and include the
project that builds this library as a depended project. Suddenly, all the
tables that were initiated with BLOCK DATA became blank. Any suggestions?
Mike
| |
| Steve Lionel 2004-12-28, 4:00 pm |
| Michael Yoshpe <myoshpe@ wrote:
> But recently i
> decided to build a static library from all fortran routines, and include the
> project that builds this library as a depended project. Suddenly, all the
> tables that were initiated with BLOCK DATA became blank. Any suggestions?
Add the line:
external block_data_name
(where block_data_name is the name of your BLOCK DATA subprogram) to the
main program. This is a common issue across compilers and platforms
when using libraries. The linker need to know to pull in the object
code that does the initialization.
Steve
| |
| Michael Yoshpe 2004-12-28, 4:00 pm |
| Already did that, with same results... The tables are still blank
"Steve Lionel" <steve.lionel@NOintelSPAM.com> wrote in message
news:btqdnbqpHp3v80zcRVn-sg@comcast.com...
> Michael Yoshpe <myoshpe@ wrote:
the[color=darkred]
the[color=darkred]
suggestions?[color=darkred]
>
> Add the line:
>
> external block_data_name
>
> (where block_data_name is the name of your BLOCK DATA subprogram) to the
> main program. This is a common issue across compilers and platforms
> when using libraries. The linker need to know to pull in the object
> code that does the initialization.
>
> Steve
| |
|
| "Michael Yoshpe
>
> I maintain a mixed-language (C-FORTRAN) project, using Compaq Visual Fortran
> 6.6C. A small C driver calls a FORTRAN subroutine, which in turn calls many
> other fortran subroutines. Some of the tables in these subroutines are
> initialized with BLOCK DATA construct. As long as i built a console exe
> application from all files at once, everything worked fine. But recently i
> decided to build a static library from all fortran routines, and include the
> project that builds this library as a depended project. Suddenly, all the
> tables that were initiated with BLOCK DATA became blank. Any suggestions?
Get rid of the block data and replace it with a regular subroutine.
Also, skip static lib antiquities, in CVF it's faster and easier to
construct a dll.
| |
| Pierre Asselin 2004-12-29, 3:58 pm |
| Steve Lionel <steve.lionel@nointelspam.com> wrote:
> Michael Yoshpe <myoshpe@ wrote:
[color=darkred]
> Add the line:
> external block_data_name
> (where block_data_name is the name of your BLOCK DATA subprogram) to the
> main program.
That may not be enough. Try adding a bogus subroutine in the file that
has your main program,
subroutine never_called
call block_data_name
return
end
The hope is that the "never_called" routine will be included into the
executable, because it is in an object file that is being linked; that
will force the linker to resolve the symbol "block_data_name" from the
library.
All sorts of things could go wrong with this scenario, so I would consider
it a band-aid at best. If it works now, it's a good five-minute fix to
keep you going but it may break at the next minor revision of your
compiler. Use the time you just bought to get rid of the block data.
--
pa at panix dot com
|
|
|
|
|