Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Common Block and static library

Kusiek__Adam
Beginner
99 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
Black Belt Retired Employee
99 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.

 

Reply