I have gcc 3.4.5 for Windows (Mingw). And NASM.
Assuming this is possible:
(1) What options do I give NASM to create an object file compatible
with gcc?
(2) How do I link this file to C files? (I've never used gcc on more
than one file nor used the linker directly).
An example to combine just one .c file and one .asm file would be
great!
Thanks,
--
Bartc
Looked like I would have to sort this myself!
The setup is:
gcc 3.4.5 (mingw special) on Windows (not Cygwin)
nasm 2.02
Input files: abc.c, def.asm
I tried using the linker directly, but it is utterly impossible (found
the library libcrtdll.a, then it can't resolve __main or ___main...)
But gcc can be used to invoke the linker indirectly. The steps needed
are:
gcc -c abc.c
(produces abc.o)
nasm -fwin32 def.asm
(produces def.obj)
gcc abc.o def.obj
Links the files, creating (because I don't know how to specify the
output!) a.exe.
So gcc is quite happy working with the .obj output of nasm. (However
I'm dreading the day when I have a more elaborate linking
requirement..)
--
Bart
You could try this:
gcc -o mybinary.exe abc.o def.obj
Cheers,
-michael
--
> Nenne mir ein Wort und ich erkläre Dir, daß es griechischen Ursprungs
> ist
Na dann: Semmelknödel und Wolpertinger
(Anastasios Tsitlakidis und Michael Rauscher in d.c.l.j)