Hey there,
I have got two problems concerning FTN95 shared memory. Please consider the ftn95 /help page 'Extended ALLOCATE statement' for reference.
A)
After allocating a segment of shared memory in my main program, I can successfully access this memory from outside with a small test program.
However, I need to start another instance of my main program and access the memory from there. With exactly the same code as in the test program, the second instance of my main program somehow fails to view the shared memory. How is this possible?
I will include the code samples for reference:
Allocation in main program:
len = (nss+4)*SIZEOF_REAL + 2*SIZEOF_INT
ALLOCATE(emap(1:len),
& SHARENAME='FEAPEmap')
Working test program to view shared memory:
PROGRAM salMemTest
IMPLICIT NONE
INTEGER, PARAMETER :: nss = 6, SIZEOF_REAL = 8,
& SIZEOF_INT = 4
INTEGER*1, ALLOCATABLE, DIMENSION(:) :: emap
ALLOCATE(emap(1:(nss+4)*SIZEOF_REAL+2*SIZEOF_INT),
& SHARENAME='FEAPEmap')
WRITE (*,*) 'Allocated emap at adr.', LOC(emap)
WRITE (*,*) emap(1:88)
END PROGRAM
Not-working memory access in second instance of main program:
INTEGER*1, ALLOCATABLE, DIMENSION(:) :: emap, nssmap
ALLOCATE(emap(1:(nss+4)*8+2*4),
& SHARENAME='FEAPEmap')
WRITE (*,*) 'mem=',emap(1:88)
(the output is just zeros)
Even more confusing: The second memory segment (nssmap), which is just 4 bytes, works perfectly and can be read from the second instance. Only emap fails to allocate.
B)
This is a small one. When trying to deallocate the shared memory segments via
CALL ENABLE_DEALLOCATE@(hndl)
I get a linker warning:
WARNING the following symbols are missing:
ENABLE_DEALLOCATE# C:\\FEAP_nogfx\\FEAP\\source\\feap_shmem_sa
lPP.obj
(C:\\FEAP_NOGFX\\FEAP\\SOURCE\\FEAP_SH
MEM_SALPP.FOR)
How's that? I use Ftn95 version 6.10.0, this error occurs with 6.00, too.