- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to use the function RaiseException(). I'm having trouble sending in the last argument...what is the correct way to send it in?
[fxfortran] USE KERNEL32
USE IFWINTY
TYPE(T_EXCEPTION_RECORD) xr
INTEGER(ULONG_PTR) lpArguments
xr%ExceptionInformation(1)=696969
xr%ExceptionInformation(2)=333333
xr%ExceptionInformation(3)=777777
lpArguments=%LOC(xr%ExceptionInformation)
CALL RaiseException(1,0,3,lpArguments)[/fxfortran]
If I get rid of the lpArguments variable
[fxfortran] CALL RaiseException(1,0,3,xr%ExceptionInformation)[/fxfortran]
I get this error:
error #6634: The shape matching rules of actual arguments and dummy arguments have been violated. [EXCEPTIONINFORMATION]
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the fourth argument is incorrectly declared in module KERNEL32. It looks to me as if someone started to define it correctly, but did only half the job.
See if the following declaration works for you.
The lpArguments argument is an array of pointer-sized arguments. If you use the above as-is, you'll need to rename away the matching definition from KERNEL32. Alternatively, you can change the local name of the subroutine in this interface and use the changed name.
See if the following declaration works for you.
[fortran]INTERFACE
SUBROUTINE RaiseException( &
dwExceptionCode, &
dwExceptionFlags, &
nNumberOfArguments, &
lpArguments)
import
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'RaiseException' :: RaiseException
integer(DWORD) dwExceptionCode ! DWORD dwExceptionCode
integer(DWORD) dwExceptionFlags ! DWORD dwExceptionFlags
integer(DWORD) nNumberOfArguments ! DWORD nNumberOfArguments
!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL, IGNORE_LOC :: lpArguments
integer(ULONG_PTR), dimension(*) :: lpArguments ! ULONG_PTR* lpArguments
END SUBROUTINE
END INTERFACE[/fortran] The lpArguments argument is an array of pointer-sized arguments. If you use the above as-is, you'll need to rename away the matching definition from KERNEL32. Alternatively, you can change the local name of the subroutine in this interface and use the changed name.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The last argument of "RaiseException" was declared as below in "include\kernel32.f90":
!DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC :: lpArguments
integer(ULONG_PTR) lpArguments ! ULONG_PTR* lpArguments
It is the reference of the exception arguments array. In this case it can be called as:
CALLRaiseException(1,0,3,xr%ExceptionInformation(1))
!DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC :: lpArguments
integer(ULONG_PTR) lpArguments ! ULONG_PTR* lpArguments
It is the reference of the exception arguments array. In this case it can be called as:
CALLRaiseException(1,0,3,xr%ExceptionInformation(1))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the fourth argument is incorrectly declared in module KERNEL32. It looks to me as if someone started to define it correctly, but did only half the job.
See if the following declaration works for you.
The lpArguments argument is an array of pointer-sized arguments. If you use the above as-is, you'll need to rename away the matching definition from KERNEL32. Alternatively, you can change the local name of the subroutine in this interface and use the changed name.
See if the following declaration works for you.
[fortran]INTERFACE
SUBROUTINE RaiseException( &
dwExceptionCode, &
dwExceptionFlags, &
nNumberOfArguments, &
lpArguments)
import
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'RaiseException' :: RaiseException
integer(DWORD) dwExceptionCode ! DWORD dwExceptionCode
integer(DWORD) dwExceptionFlags ! DWORD dwExceptionFlags
integer(DWORD) nNumberOfArguments ! DWORD nNumberOfArguments
!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL, IGNORE_LOC :: lpArguments
integer(ULONG_PTR), dimension(*) :: lpArguments ! ULONG_PTR* lpArguments
END SUBROUTINE
END INTERFACE[/fortran] The lpArguments argument is an array of pointer-sized arguments. If you use the above as-is, you'll need to rename away the matching definition from KERNEL32. Alternatively, you can change the local name of the subroutine in this interface and use the changed name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's what I was missing! It worked either way, I'll put a TODO note to check if they change that in a future version of IVF.
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