Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on May 11, 2026, 09:45:46 PM

Title: Combining object files
Post by: Vortex on May 11, 2026, 09:45:46 PM
Ld, the GNU linker has an interesting feature, it can combine object modules files to create one monolithic object file. The example below combines StdOut.obj ( function to write to the console window ) and the dependency StrLen.obj ( string lenght calculator ) to output one file named Modules.obj

\PellesC\bin\poasm /AIA32 StrLen.asm

\PellesC\bin\poasm /AIA32 StdOut.asm

\PellesC\bin\poasm /AIA32 Sample.asm

C:\msys64\mingw32\i686-w64-mingw32\bin\ld -r -m i386pe -o Modules.obj StdOut.obj StrLen.obj

C:\Masm64\bin64\link /SUBSYSTEM:CONSOLE /LIBPATH:\PellesC\Lib\Win Sample.obj Modules.obj kernel32.lib user32.lib