Hi Group,
I am having problems building some Fortran source into a DOS executable.
I should explaine the reason for doing this is to check that the source
performs in the same way as the original program.
The source segments looks like this:
I = EXDOS('TYPE FSMENU.TXT')
and the functions looks like this including comments to assist in its
understanding:
INTEGER FUNCTION EXDOS( CMD )
* * Issue a DOS command from within an executing FORTRAN
application.
* * Can be used to implement overlays of pre-compiled "EXE"
programs.
* * Example: Issue a DOS 'COPY' command
* * RETCOD = EXDOS( 'COPY *.FOR \BACKUP\FORTRAN' )
* * Example: Run two separate parts of an appli*ation
* * RETCOD = EXDOS( 'PART1' )
* * RETCOD = EXDOS( 'PART2' )
* * Requirements: This program uses the integer-valued FORK and
DOSENV
* * functions located in WATFOR.LIB.
character*(*) cmd
integer fork, dosenv, com_len
character comspec*80, cmdlin*128
com_len = dosenv( 'COMSPEC', comspec )
if( com_len .eq. 0 )then
comspec = '
command.com'
com_len = 11
endif
comspec(com_len+1:com_len+1) = char(0)
cmdlin(1:1) = char( 3 + len( cmd ) )
cmdlin(2:4) = '/* '
cmdlin(5:) = cmd
exdos = fork( comspec, cmdlin )
end
**Referencing library: FORK - E:\WF77\WATFOR.LIB(FORK)
**Referencing library: DOSENV - E:\WF77\WATFOR.LIB(DOSENV)
**Referencing library: EXT_TO_WF77 - E:\WF77\WATFOR.LIB(WEXT)
As you can see the function call is trying to diplay a text file to screen
and uses a library called WATFOR.LIB.
The build executable when run returns the following error:
16 bit MS_DOS Subsystem
c:\Windows\system32\cmd.exe - fs_opt (which is the name of the program)
The NTVDM CPU has encountered an illegal instruction
Does anyone know if WARFOR.LIB is a WATCOM product?
Is there an alternative solution for issuing DOS commands from Fortran
statements?
Thanks for any assistance.
Regards,
Mike