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

Common Block and static library

Kusiek__Adam
Beginner
311 Views

Hi, 

I have a question about COMMON block and enclosing the code in static library. The problem is as follows: 

I need to combine in static library some subroutines which uses common block data (code is not written by me). When I call the subroutine from the compiled library (in c++) the matrices defined in common block data have all values equal 0 (values displayed in Fortran subroutine enclosed in library) 

The common block data are used internally inside library. Since I do not want to have access to this block data in C/C++ (but use it internally inside fortran library) should I somehow force compiler to initialize this matrices first? 

Best, 

Adam 

 

 

 

  

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
311 Views

You can use a BLOCK DATA subprogram that initializes the COMMON block. You must then give the name of the BLOCK DATA subprogram in an EXTERNAL statement in each procedure that uses the COMMON. The compiled BLOCK DATA subprogram must also be inserted into the library - it will get pulled in by ld because of the EXTERNALs.

I assume that you don't want zeroes for the initial values.

 

0 Kudos
Reply