Hi revolution ! Thank you for the kind attention !
The devil - as we know - is in the details, and it is the interfacing details I am querying for. As for your genral suggestions,
1. I don't think g77 has a mechansm whereby compiled programs would run (MS windows) DLLs
3. g77 does not support inline assembly, unlike some newer GNU Fortran compilers.
2. This, I guess, is what I'm asking, a "how-to" : details of all the needed glue. I am not even sure of the format of object files used by Fortran, though I assume they would be Coff rather than old Intel/MS "OMF". Can FASM output object modules instead of statically compiled whole programs ? How do we instruct it it do so ? How does it exmport/import public names ? I'd really really need to see a sample, or template albeit incomplete.
Last edited by NimbUs on 24 Jun 2017, 16:15; edited 1 time in total
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:
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'.
Back to report I have solved the actual Fortran-ASM interfacing problem,
using not FASM but NASM this time, another fine assembler (which I had not previously tried) that will natively assemble to a number of object file formats, including Coff and its win32 variant, which is exactly what was expected by the g77 compiler suite on my (Windows XP 32 bits) platform... The interested could find details in a recent thread in the usenet news group comp.lang.asm.x86 (also archived as "google groups").
@Revolution, @Xorpd! : thanks for your above replies, which show that there are probably ways to skin this cat using the FASM, too...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum