Hello Ted, Phillip, Glenn, Neil, ...
>> I am working on a library module (A), which makes uses of an
>> user supplied procedure (P) which, preferably, is placed in
>> another module (B). In particular, it should be possible to
>> compile A without knowing the body of B. However, a rudimental
>> version of B containing a dummy for P could be supplied.
Phillip Helbig:
> I don't think so. I have struggled with this quite a bit, and
> never got a satisfactory solution from this or any other source.
Ted Stern:
> The only thing that comes to mind is to pass the user supplied
> procedure as a dummy argument.
-- this should work, however I would prefer not to have those
procedure arguments
David Vowels:
> So one solution I have implemented (for evaluation) is a reverse
> communication interface in module A. That is module A requests
> information from the user module (B) when required.
-- in my case it is actually the procedure (P) what is required.
Phillip Helbig:
> One CAN write the interface by hand, which might be better than
> nothing (i.e. better than the EXTERNAL routine approach) but then
> one has to make sure that B, when it is written, corresponds to the
> interface.
This is, indeed, what I doing now (see below). Unfortunately there
seems to be no (standard) way to provide the module information for
(B), which would be necessary to compile (A) seperatly. Only the
interface of the requested procedure (P) can be put into a module.
P itself has then to be a naked procedure. I can live with this
solution. However, it is incompatible with the F language which
is offen referred to as "good style" Fortran.
Cheers,
Joerg
Sketch of my solution:
Library:
============================================================
MODULE Application_Interface
INTERFACE
SUBROUTINE P( ... )
! USE modules req'd for P's arguments
! declare arguments
END SUBROUTINE P
END INTERFACE
END MODULE Application_Interface
------------------------------------------------------------
MODULE A
USE Application_Interface
CONTAINS
SUBROUTINE S( ... )
CALL P( ... )
END SUBROUTINE S
END MODULE A
============================================================
Application specific code -- cannot be placed into a MODULE:
============================================================
SUBROUTINE P( ... )
! USE modules req'd for P's arguments
! declare arguments
! procedure body
END SUBROUTINE P
============================================================
--
Dr.-Ing. Joerg Stiller, Dozent fuer Geo- und Magnetofluiddynamik
----------------------------------------------------------------
Technische Universitaet Dresden TEL : (0351) 463 - 8328
Institut f. Luft- und Raumfahrtechnik FAX : (0351) 463 - 8087
D-1062 Dresden [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|