Pinocchio6
04-15-2004, 10:51 AM
Hi,
I do have a mixed language environment with C# and Fortran. The C# code is as follows:
public interface IntA
{
void Method();
}
public abstract class AObj : IntA
{
}
public interface IntB
{
void Do(AObj aobj);
}
Now I want to implement an object in Fortran which inherits from interface IntB:
type, implements(IntB) :: Sample
contains
procedure, pass :: Do
end type Sample
contains
subroutine Do(this, aobj)
type(Sample) :: this
type(AObj) :: aobj
! type(AObj), target :: aobj ! error FRT1244
type(IntA), pointer :: ia
ia => aobj ! error FRT1386
end subroutine Do
My problem is that I dont know how to access IntB.Method() on object AObj, because if I try to use
type(AObj), target :: aobj
so that ia => aobj is possible, I get error FRT1244 - derived type 'Sample' must implement interface member 'Do'
On the other hand, when I use
type(AObj) :: aobj
I get FRT1386 - Pointer object in pointer assignment statement must be a variable name or a structure component which has the POINTER attribute
on ia => aobj.
Is there a workaround for this?
Regards, Charlie
I do have a mixed language environment with C# and Fortran. The C# code is as follows:
public interface IntA
{
void Method();
}
public abstract class AObj : IntA
{
}
public interface IntB
{
void Do(AObj aobj);
}
Now I want to implement an object in Fortran which inherits from interface IntB:
type, implements(IntB) :: Sample
contains
procedure, pass :: Do
end type Sample
contains
subroutine Do(this, aobj)
type(Sample) :: this
type(AObj) :: aobj
! type(AObj), target :: aobj ! error FRT1244
type(IntA), pointer :: ia
ia => aobj ! error FRT1386
end subroutine Do
My problem is that I dont know how to access IntB.Method() on object AObj, because if I try to use
type(AObj), target :: aobj
so that ia => aobj is possible, I get error FRT1244 - derived type 'Sample' must implement interface member 'Do'
On the other hand, when I use
type(AObj) :: aobj
I get FRT1386 - Pointer object in pointer assignment statement must be a variable name or a structure component which has the POINTER attribute
on ia => aobj.
Is there a workaround for this?
Regards, Charlie