- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page