brtnfld <
epil...@att.net> wrote:
> RECURSIVE INTEGER FUNCTION op_func() RESULT(ret_val) BIND(C)
> TYPE(C_FUNPTR) :: funptr
> funptr = C_FUNLOC(op_func)
> and I verified the address of funptr is correctly passed to the C code.
> Stepping through the assembly code it segfaults at
If the address is correctly passed, it should work.
Just to be sure, you either declare the argument of the C routine
as VALUE, or you get a pointer to the function pointer, which you
have to dereference. But that should be the same for the non-recursive
case, which you say works.
> 0x00007fff08084ac0 20 dd and ch, bl
> where 0x00007fff08084ac0 is the address given by funptr, 20 dd is the
> Opcode and "and ch, bl" is the Source. I don't know what that means.
> If I do:
> funptr = C_FUNLOC(op_func)
> in another subroutine (i.e. not within the recursive function), then on
> the C side the debugger shows the address and the function name:
> 0x404d34 <op_func>
> but for the recursive function, the debugger shows in C just the address,
> no function name, which seems odd, but maybe it's nothing.
-- glen