g77 can run DLLs. Just make a *.LIB file when you make the *.DLL and link against the *.LIB file and make sure the *.DLL is in your path when you run the executable. Now, if the *.DLL procedure is STDCALL that may be a problem.
You can find out the format of a *.OBJ file or *.o file with objdump.exe, which comes with the GNU utilities, thus you probably already have it in your path as a consequence of having installed g77.
FASM can compile to *.OBJ files. The secret sauce is 'format MS coff' or 'format MS64 coff' or 64-bit code. It can export name via the public keyword. A brief example:
Code: |
D:\gfortran\clf\rdtsc>type rdtsc_32.asm
format MS coff
section '.text' code readable executable
public _rdtsc_32_
_rdtsc_32_:
rdtsc
ret
D:\gfortran\clf\rdtsc>fasm rdtsc_32.asm
flat assembler version 1.71.49 (1048576 kilobytes memory)
1 passes, 114 bytes.
D:\gfortran\clf\rdtsc>objdump -f rdtsc_32.obj
rdtsc_32.obj: file format pe-i386
architecture: i386, flags 0x00000039:
HAS_RELOC, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000
D:\gfortran\clf\rdtsc>type hello32.f
PROGRAM HELLO32
IMPLICIT NONE
INTEGER*8 RDTSC_32
EXTERNAL RDTSC_32
INTEGER*8 T0, TF
T0 = RDTSC_32()
WRITE(*,*) 'Hello, world'
TF = RDTSC_32()
WRITE(*,*) 'Time = ',TF-T0
END
D:\gfortran\clf\rdtsc>gfortran hello32.f rdtsc_32.obj -ohello32
D:\gfortran\clf\rdtsc>hello32
Hello, world
Time = 570736
|
|
I'm not sure whether this will work with g77, though. Use objdump.exe on a g77-generated *.o file to discover file format, name mangling, and calling convention.
g77 is kind of archaic and you will get much better help if you can move up to gfortran. You will want to anyhow when you find that 32-bit code doesn't have a hardware instruction for 64X64->128 multiply. Just sayin'.