TYPE SampleGrid
TYPE(SampleType), DIMENSION(:,:), ALLOCATABLE :: Samples
Blablabla
END TYPE
CONTAINS
blablablablabla
END MODULE
Another MODULE uses this module and refers to a variable of type SampleGrid. No complaints! Even though the SampleType, the type of the component of SampleGrid, is NOT exported by module LibSample!
I’ll send you the info+code on monday. Here at home I don’t have access to all the stuff. We use the Linux version of pgf90 and probably not the latest release. There is no dll involved in my work. Just a bunch of .f90 files with 1 module per file and one main program.
pgf90 6.1-4 32-bit target on x86-64 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2006, STMicroelectronics, Inc. All Rights Reserved.
When I do pgf90 -c libsample.f90 on the following code,
I get no problems with the compiler. In this code I declare
three public variables CoarsGrid, MesoGrid and FineGrid. The user-defined
type SampleType is defined as private and therefore no module or program that will use LibSample will know what to do with the Sample-component of the three global variables. I would have liked a warning/error message from the compiler like:
“TYPE(SampleType), DIMENSION(:,:), ALLOCATABLE :: Sample
^
Component Sample of SampleGridType will be invisible to
other units. Type SampleType is declared as private to this module.”
Maybe the compiler hopes that I will define SampleType in another module,
just like GridSpecsType, LocalMeteoGridType, Float and NuclideVector. Still, the fact that SampleGridType has a locally consistent, private meaning to this module should have triggered an alarm about its use outside the module.
Regards,
Arjan
MODULE LibSample
USE libxmath
USE libutil
USE libgrid
USE libdate
USE libcoordinate
USE liblookup
USE libmeteo
USE libnuclide
IMPLICIT NONE
!
! Principally everything is LOCAL...
!
PRIVATE
!
! ... except for the following:
!
PUBLIC :: SampleGridType,CoarseGrid,MesoGrid,FineGrid
TYPE SampleType
TYPE(NuclideVector) :: Con,MomDep,Dep,ICon,IDep
END TYPE SampleType
TYPE SampleGridType
INTEGER :: CoordinateSystem
TYPE(GridSpecsType) :: GridSpecs
REAL(Float) :: z
TYPE(LocalMeteoGridType) :: Meteo
TYPE(SampleType), DIMENSION(:,:), ALLOCATABLE :: Sample
END TYPE SampleGridType
TYPE(SampleGridType) :: CoarseGrid,MesoGrid,FineGrid
CONTAINS
END MODULE LibSample
Maybe the compiler hopes that I will define SampleType in another module,
just like GridSpecsType, LocalMeteoGridType, Float and NuclideVector.
ps. Even if this assumption about the definition of SampleType in another module were correct, then the linker should have seen that my main program will never work because no other module had done the job.