2

I want to create a dll from following fortran77 code by using g77 compiler in Windows.

sample FORTRAN code

test.f

  SUBROUTINE fsub (x)
    INTEGER*4 x
    x = x + 1
  END

  INTEGER*2 FUNCTION ffunc (y)
    INTEGER*2 y
    ffunc = y + 1
  END

  SUBROUTINE fstring (fstr)
    CHARACTER*20 fstr
    fstr = 'Jack Be Nimble'
  END

I have used the following command

g77 -fno-f2c -shared -s -o test.dll test.f

but it gives an error saying

g77: unrecognized option `-shared'
..\lib\gcc-lib\i386-mingw32\2.95\..\..\..\libg2c.a(main.o)(.text+0x38): undefined 
reference to 'MAIN__'

Screenshot

Alternatively I downloaded Mingw and tried to do the same using gfortran.exe

gfortran.exe -fno-f2c -shared -s -o test.dll test.f 

Successfully created the test.dll.

My requirement is to create the dll using g77 but i am getting this "unrecognized option `-shared'"

Please help.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Sid
  • 245
  • 7
  • 18

0 Answers0