$TITLE 'Test expert level Fortran API to read and write GDX' (FEX1,SEQ=9) $ontext Contributor: Lutz Westermann, October 2012 $offtext $set srcRoot %gams.sysdir%apifiles%system.dirsep%Fortran%system.dirsep% $set srcRootC %gams.sysdir%apifiles%system.dirsep%C%system.dirsep% $ifThen %system.filesys% == UNIX $ if not set COMPILER $set COMPILER GNU $else $ if not set COMPILER $set COMPILER INTEL $endIf $ifThen %COMPILER% == GNU $ set FCOMP gfortran $ set CCOMP gcc $ set LIB ar ruv $ set LIBOP $ set LIBEX a $ set OBJEX o $ set SYMSTY -DAPIWRAP_LCASE_DECOR $ ifThen %system.filesys% == UNIX $ set OUT -oxp_example1 $ set FLAGS -ldl $ set LDFLAGS -lpthread $ else $ set OUT -oxp_example1.exe $ set FLAGS $ set LDFLAGS $ endIf $elseIf %COMPILER% == INTEL $ set FCOMP ifort $ set CCOMP cl $ set LIB lib $ set LIBOP -out: $ set LIBEX lib $ set OBJEX obj $ set FLAGS $ set SYMSTY -DAPIWRAP_LCASE_NODECOR $ set OUT -Fexp_example1.exe $ set LDFLAGS $else $ abort Unknown compiler: %COMPILER% $endIf $call rm -rf demanddata.gdx $call %FCOMP% -c "%srcRoot%api%system.dirsep%gdxf9def.f90" %FLAGS% $if errorlevel 1 $abort 'Problem compiling gdxf9def.f90' $call %CCOMP% %SYMSTY% -c "%srcRoot%api%system.dirsep%gdxf9glu.c" -I"%srcRootC%api" -I"%srcRoot%api" %FLAGS% $if errorlevel 1 $abort 'Problem compiling gdxf9glu.c' $call %LIB% %LIBOP%gdxf90lib.%LIBEX% gdxf9def.%OBJEX% gdxf9glu.%OBJEX% $if errorlevel 1 $abort 'Problem creating lib file' $call %FCOMP% -c "%srcRoot%api%system.dirsep%gamsglobals_mod.f90" "%srcRoot%xp_example1.f90" %FLAGS% $if errorlevel 1 $abort 'Problem compiling xp_example1.f90' $call %FCOMP% %OUT% gamsglobals_mod.%OBJEX% xp_example1.%OBJEX% gdxf90lib.%LIBEX% %FLAGS% %LDFLAGS% $if errorlevel 1 $abort 'Problem while linking' $call .%system.dirsep%xp_example1 "%gams.sysdir%." $if errorlevel 1 $abort 'Problem executing xp_example1 writing GDX file' $call gdxdiff demanddata.gdx demandwant.gdx $if errorlevel 1 $abort 'Demanddata not as expected' $call .%system.dirsep%xp_example1 "%gams.sysdir%." trnsport.gdx $if errorlevel 1 $abort 'Problem executing xp_example1 reading GDX file'