g95 / Linux / 'shared global COMMON' 
Author Message
 g95 / Linux / 'shared global COMMON'

I am using g95 under Red Hat Linux 9

I have been looking at two existing schemes of sharing data in COMMON
between two programs. (With acknowledgements to the originators).

1) The main program invokes shmget (via a C subprogram) to create a
separate block of data in memory, which is subsequently read from or
written to

2) The defsym linker option is invoked, and the COMMON blocks from
each program attached to it.

Now program (1) has all the problems associated with copying data from
one block of memory to another.
In program (2) the linker assigns an specified address for the data;
however, I suspect, perhaps wrongly, that sooner or later something
else will be at that address with unpleasant results.

Can I have my cake and eat it.

David Flower



Mon, 08 Mar 2010 22:07:45 GMT  
 g95 / Linux / 'shared global COMMON'

Quote:

> I am using g95 under Red Hat Linux 9

> I have been looking at two existing schemes of sharing data in COMMON
> between two programs. (With acknowledgements to the originators).
...
> 2) The defsym linker option is invoked, and the COMMON blocks from
> each program attached to it.
...
> In program (2) the linker assigns an specified address for the data;
> however, I suspect, perhaps wrongly, that sooner or later something
> else will be at that address with unpleasant results.

I seriously doubt that this will work, for exacly the opposite reason
that you mention. I suppose I could be confused on the matter, but...

There will never be something else at that address because the address
assigned is a virtual address in the program's virtual adderss space -
not a hardware address. Each program will have its own distinct virtual
address space... which means that this "method" won't have the effect
you are looking for.

--
Richard Maine                    | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle           |  -- Mark Twain



Mon, 08 Mar 2010 23:55:05 GMT  
 g95 / Linux / 'shared global COMMON'

Quote:

> ...
> Can I have my cake and eat it.

Try changing recipes, by forgetting COMMON blocks.

Since g95 supports F2K C Interop, you can use the C_F_POINTER
intrinsic to associate an F90 pointer to your shared memory area.

W.



Tue, 09 Mar 2010 01:24:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Ratio between agent's share and consultant's share

2. Ratio between agent's share and consultant's share

3. Share global variables in different DLL's

4. un-'upvar'ing/un-'global'ing variables

5. g95: installation problem, cannot exec 'f951': No such file or directory

6. Readl basic probem - can't import shared library modules on Linux

7. Tcl's configure on linux has a small shared lib bug

8. Can't --enable-shared with Linux

9. Mapping POSIX IPC shared memory to f77 global common on Digital Unix

10. warning: overriding global function 'initialize'

11. namespaces and 'global'

12. Accessing one's main script's global from imported libraries

 

 
Powered by phpBB® Forum Software