Fortran LIB$WAIT fails with invalid arguments
-
Topic author - Active Contributor
- Posts: 27
- Joined: Tue Apr 23, 2024 6:28 am
- Reputation: 0
- Status: Offline
Fortran LIB$WAIT fails with invalid arguments
My Fortran LIB$WAIT test program always fail with %LIB-F-INVARG, invalid argument(s) regardless of what /FLOAT compile switch I use or the float type argument to the routine. I wrote a similar C test program and that works BUT the float type argument must be specified otherwise it too fails with %SYSTEM-F-FLTINV, floating invalid operation. I believe the default float type is IEEE_S in Fortran or C but for some reason, it's not working properly with LIB$WAIT. Maybe the problem is specific to x86 but I don't have a real box to confirm.
Virtualbox Version 7.0.14 r161095 (Qt5.15.2)
Windows 11
x86 OpenVMS 9.2-2 VMDK
Virtualbox Version 7.0.14 r161095 (Qt5.15.2)
Windows 11
x86 OpenVMS 9.2-2 VMDK
- Attachments
-
- TESTWAIT_FOR.TXT
- (536 Bytes) Downloaded 21 times
-
- TESTWAIT.C
- (589 Bytes) Downloaded 27 times
-
- Visitor
- Posts: 2
- Joined: Sat May 04, 2024 11:48 pm
- Reputation: 0
- Status: Offline
Re: Fortran LIB$WAIT fails with invalid arguments
you need an include '($libwaitdef)' in there somewhere.
Added in 3 minutes 57 seconds:
i should have mentioned that this would have been more clear had there been an implicit none. since there isn't, the compiler has helpfully created integers name lib$k_nowake and lib$k_ieee_s, which you haven't initialized.
compilation yields:
Code: Select all
program argh
include '($libwaitdef)'
real wait
integer r0
wait=3.4
print *,'start wait', wait, ' secs'
r0 = lib$wait( wait, lib$k_nowake, lib$k_ieee_s )
call lib$signal( %val( r0 ) )
print *,'end wait r0=',r0
end
i should have mentioned that this would have been more clear had there been an implicit none. since there isn't, the compiler has helpfully created integers name lib$k_nowake and lib$k_ieee_s, which you haven't initialized.
Code: Select all
program argh
implicit none
print *,lib$k_nowake
print *,lib$k_ieee_s
end
Code: Select all
$ for argh
print *,lib$k_nowake
................^
%F90-E-ERROR, This name does not have a type, and must have an explicit type.
[LIB$K_NOWAKE]
at line number 3 in file DKA0:[RIVIE.BOOGER]ARGH.FOR;5
print *,lib$k_ieee_s
................^
%F90-E-ERROR, This name does not have a type, and must have an explicit type.
[LIB$K_IEEE_S]
at line number 4 in file DKA0:[RIVIE.BOOGER]ARGH.FOR;5
$
Re: Fortran LIB$WAIT fails with invalid arguments
Code: Select all
> include '($libwaitdef)'
Or:
its $ gdiff TESTWAIT.FOR TESTWAIT3.FOR
16c16
< r0=lib$wait(wait,LIB$K_NOWAKE,LIB$K_IEEE_S)
---
> r0=lib$wait( wait, 1, 4)
> [...] implicit none [...]
One of the best things ever to happen to FORTRAN/Fortran.
-
Topic author - Active Contributor
- Posts: 27
- Joined: Tue Apr 23, 2024 6:28 am
- Reputation: 0
- Status: Offline
Re: Fortran LIB$WAIT fails with invalid arguments
Thanks that worked! Good pick up. I've been so used to modern compilers picking up these errors that I totally forgot about implicit none in Fortran. Funny to think 40 years ago, I worked with it every day.
-
- Master
- Posts: 409
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
Re: Fortran LIB$WAIT fails with invalid arguments
There are a few LIB$ functions where I actually prefer the system services.
LIB$WAIT is one of them.
integer*8 t
...
call sys$schdwk(, , t, )
call sys$hiber()
seems more natural to me.
(t is a VMS delta time so negative number of 100ns units)
LIB$WAIT is one of them.
integer*8 t
...
call sys$schdwk(, , t, )
call sys$hiber()
seems more natural to me.
(t is a VMS delta time so negative number of 100ns units)
-
Topic author - Active Contributor
- Posts: 27
- Joined: Tue Apr 23, 2024 6:28 am
- Reputation: 0
- Status: Offline
Re: Fortran LIB$WAIT fails with invalid arguments
I like it Arne, I'm gonna use this instead. None of this float type nonsense.