Drew Mccormack wrote:
> call saveOrMessageProcPointer(MyRoutine, .true.)
This will pass the address of MyRoutine on the stack, and than the
routine saveOrMessageProcPointer will try to read an integer from this
address, which obviously won't work. You need the VALUE attribute.
Also:
> integer*4, save :: savedPtr
> call Message(savedPtr)
Typically this will be passed so that the address to savedPtr is passed,
while Message is typically implemented so that it gets the address of
the procedure, which in this case is the *value* of savedPtr. In the
e-mail I sent to this list giving C Interop codes for using the DL
(dynamic linking) library, and it used the VALUE attribute in order to
hack passing a procedure pointer as an integer.
By using some minimal C code I have written Fortran 90 codes to emulate
procedure pointers, without the use of VALUE. I can dig in my modules to
find out what I did if it is relevant. But it is easier if you have VALUE.
Aleks
|