- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to make som dynamic objects, so I, want to return the pointer of a type.
If I make the Subroutine test, I get the Error "A dummy argument object cannot be a pointee. [PC]
"
If I make the function test2 I even get a catastrophic error "catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error."
subroutine test(pc)
use LST_DEF
implicit none
! input variables
! output variables
type(DUL_PRESENTATIONCONTEXT) pc
POINTER (p_addr, pc)
end subroutine
function test2() RESULT(pc)
use LST_DEF
implicit none
! input variables
! output variables
type(DUL_PRESENTATIONCONTEXT) pc
POINTER (p_addr, pc)
end function
If I make the Subroutine test, I get the Error "A dummy argument object cannot be a pointee. [PC]
"
If I make the function test2 I even get a catastrophic error "catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error."
subroutine test(pc)
use LST_DEF
implicit none
! input variables
! output variables
type(DUL_PRESENTATIONCONTEXT) pc
POINTER (p_addr, pc)
end subroutine
function test2() RESULT(pc)
use LST_DEF
implicit none
! input variables
! output variables
type(DUL_PRESENTATIONCONTEXT) pc
POINTER (p_addr, pc)
end function
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The pointers you are using are an extension to the FORTRAN standard often called Integer Pointers. The IVF manualexplicitly states that an integer pointer cannot point to a dummy argument (see section POINTER - Integer in the IVF manual). Therefore, what you are trying to do seems not to be allowed.
Using standardFORTRAN pointers howevershould work (see below).
regards,
Thomas
Using standardFORTRAN pointers howevershould work (see below).
regards,
Thomas
[plain]FUNCTION Test(arg) result(res) TYPE (tArg), TARGET :: arg TYPE (res),TARGET :: res TYPE (tArg), POINTER :: p_arg TYPE(res), POINTER :: p_res p_arg => arg p_res => res END FUNCTION
[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This sort of thing is done all the time in Win32 programming, where the lParam argument frequently passes a pointer to some windows structure, depending on the message type:
[cpp]INTEGER FUNCTION MyProc (hwnd, msg, wParam, lParam) RESULT (res) ... IMPLICIT NONE INTEGER(HANDLE), INTENT(IN) :: hwnd INTEGER(UINT), INTENT(IN) :: msg INTEGER(fWPARAM), INTENT(IN) :: wParam INTEGER(fLPARAM), INTENT(IN) :: lParam ... TYPE(T_NMHDR) :: nmhdr POINTER(lParam, nmhdr)[/cpp]
I think the main idea here, where this code differs from your samples, is that the argument is declared as an integer, and then associated with the data type via the POINTER statement.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page