On 13 March 2012 23:53, Michael <p...@m1xa.com> wrote:
> On Tuesday, 13 March 2012 at 22:30:02 UTC, Tobias Brandt wrote:
>>
>> Fortran uses pass-by-ref by default. You could try
>>
>>    integer, value :: i
>>
>> in the Fortran function declaration, OR
>>
>>    *int
>>
>> in the MyHandler declaration.
>
> in case integer, value :: i or integer, intent(in) :: i
>
> same results
>
>
> in case int*
>
> int * i;
> *i=5;
> (*mh)(i);
>
> object.Error: Access Violation
> ----------------
> 409960
> 4097D7
> 402BA8
> 402BE7
> 4027F7
> 413635
> ----------------
>
>


You could use the C binding syntax:

SUBROUTINE fsu (i) bind(C, name = "FSU")
   real :: x
   integer, value :: i
   x = 0.025
   print *, 'The answer is x = ', x , i
END SUBROUTINE fsu

and then use extern(C) in D. That should work, but you
need a newish Fortran compiler.

Reply via email to