Use gcc to compile multiple c files, ml (masm) to compile multiple assembly files and link with extern linker: Undefined reference to '__main'

43 views Asked by At

My ground problem is: I want to use a modern compiler to create through multplie steps a .exp file (special very old object file format from Phar Lab which starts with P3 as magic number and runs in 32-bit DOS)

So. I am using this line of code for compiling assembly files:

ml /coff /c code.asm

For multiple asm files to generate object files

And I am running gcc -m32 -c ccode.c -o ccode.o

For multiple c-files to get all object files.

Afterwards I want to convert these object files with an converter so an old linker can use these object files to create an executable which runs in 32-bit DOS mode.

Even when I use ld with the not converted object files like this:

ld code.obj ccode.o -o output.exe

This returns multiple lines like this:

ld: code.o:code.c(.text+0x18): undefined reference to '__main' But there are lines where the undefined reference is not __main, but 'memcpy', 'free', '__mingw_vsprintf' and many more.

What can I do to get theses standard functions into the object files? Or are there other solutions?

I also tried using Open Wacom to get this old executable. But I could not install it on my windows 10 64-bit. Same with DJGPP, O could not run the needed go32-v2 it said it cannot be run in 64-bit windows... and I tried to find out if the exe file, generated by gcc when I directly compile all files, could be converted into the needed .exp file or if I can change it easily by hand. But I could jot find out how or if it is even possible

0

There are 0 answers