Author Topic: Controlling what the masm's linker include by default  (Read 178 times)

0 Members and 1 Guest are viewing this topic.

Offline ViL

  • Avocado lover 🥑
  • C= 64
  • **
  • Posts: 52
  • Karma: 1
    • View Profile
 hii! i've looked for a way to manually set the libraries that link.exe includes, by default, when i link using:

Code: [Select]
C:\masm32\bin\link.exe /verbose /nologo /subsystem:windows /opt:noref main.obj
it says:

Code: [Select]
Start Pass1

Processed /DEFAULTLIB:C:\masm32\lib\user32.lib
Processed /DEFAULTLIB:C:\masm32\lib\kernel32.lib
Processed /DEFAULTLIB:C:\masm32\lib\gdi32.lib
Processed /DEFAULTLIB:C:\masm32\lib\opengl32.lib
Processed /DEFAULTLIB:C:\masm32\lib\glu32.lib

so i tried setting the /DEFAULTLIB's parameter myself to override them

Code: [Select]
C:\masm32\bin\link.exe /verbose /nologo /subsystem:windows /defaultlib:C:\masm32\lib\user32.lib /opt:noref main.obj
(i was intending to just link the user32.lib library to intentionally produce an error to see if it worked)

and regardless, it keeps adding the rest of default libraries:

Code: [Select]
Processed /DEFAULTLIB:C:\masm32\lib\user32.lib

Start Pass1
Processed /DEFAULTLIB:C:\masm32\lib\kernel32.lib
Processed /DEFAULTLIB:C:\masm32\lib\gdi32.lib
Processed /DEFAULTLIB:C:\masm32\lib\opengl32.lib
Processed /DEFAULTLIB:C:\masm32\lib\glu32.lib

is there a way to set them manually?

for example, i recall the same happened linking in mingw's gcc.exe when i coded in c, but using mingw's collect2.exe as a linker enabled me to link them manually, so i though it was possible too in masm

thaanks beforehand! :D

EDIT: turns out they weren't magically added BUT they all were called by using includelib in the asm source!

i'll let this post here if it ever helps someone lol
« Last Edit: June 20, 2018 by ViLXDRYAD »

Offline Siekmanski

  • ZX 81
  • *
  • Posts: 8
  • Karma: 3
    • View Profile
    .686p
    .model  flat,stdcall
    .xmm
    option casemap:none

    include       \masm32\include\windows.inc
    include       \masm32\include\kernel32.inc
    includelib    \masm32\lib\kernel32.lib
    include       \masm32\include\user32.inc
    includelib    \masm32\lib\user32.lib


Assemble and link:

Ml.exe /c /coff yourprog.asm
Link.exe /SUBSYSTEM:WINDOWS yourprog.obj

« Last Edit: June 20, 2018 by Siekmanski »

Offline ViL

  • Avocado lover 🥑
  • C= 64
  • **
  • Posts: 52
  • Karma: 1
    • View Profile
yea, those includelib; reading further i realized they were stored in the obj file to tell link.exe to link those libraries automatically :D

it's way more practical than putting all the .lib in the linker command as i was used to (aside the command line is supposed to have a limit of 128 characters too)

and thanks too, Siekmanski! :)