How to static link in MASM32?

I am writing a screen saver program with MASM32.(the source files in attach archive)
a screen saver program need static link the scrnsave.lib

I look the option of LINK.EXE:

Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

usage: LINK [@commandfile]

  options:

      /ALIGN:#
      /BASE:{address|@filename,key}
      /COMMENT:comment
      /DEBUG
      /DEBUGTYPE:{CV|COFF}
      /DEF:filename
      /DEFAULTLIB:library
      /DLL
      /DRIVER[:{UPONLY|WDM}]
      /ENTRY:symbol
      /EXETYPE:DYNAMIC
      /EXPORT:symbol
      /FIXED[:NO]
      /FORCE[:{MULTIPLE|UNRESOLVED}]
      /GPSIZE:#
      /HEAP:reserve[,commit]
      /IMPLIB:filename
      /INCLUDE:symbol
      /INCREMENTAL:{YES|NO}
      /LARGEADDRESSAWARE[:NO]
      /LIBPATH:dir
      /MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
      /MAP[:filename]
      /MAPINFO:{EXPORTS|FIXUPS|LINES}
      /MERGE:from=to
      /NODEFAULTLIB[:library]
      /NOENTRY
      /NOLOGO
      /OPT:{ICF[,iterations]|NOICF|NOREF|NOWIN98|REF|WIN98}
      /ORDER:@filename
      /OUT:filename
      /PDB:{filename|NONE}
      /PDBTYPE:{CON|SEPT}
      /PROFILE
      /RELEASE
      /SECTION:name,
      /STACK:reserve[,commit]
      /STUB:filename
      /SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]
      /SWAPRUN:{CD|NET}
      /VERBOSE[:LIB]
      /VERSION:#[.#]
      /VXD
      /WARN[:warninglevel]
      /WINDOWSCE:{CONVERT|EMULATION}
      /WS:AGGRESSIVE

but no found the stalic link potion.

I build the program in QEDITOR.EXE, the run the program, I get a error message box, tell me the system can not locate the scrnsave.dll

I try to link as following, but failed:


D:\masm32\myworks\scrsaver>link /SUBSYSTEM:WINDOWS  /LIBPATH:d:\masm32\lib 1.obj rsrc.obj /DEFAULTLIB:d:\masm32\lib\scrnsave.lib  /DEF:1.def
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

  Creating library 1.lib and object 1.exp



D:\masm32\myworks\scrsaver>link /SUBSYSTEM:CONSOLE  /LIBPATH:d:\masm32\lib 1.obj
rsrc.obj /DEF:1.def
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

  Creating library 1.lib and object 1.exp



How can I static link in MASM32?
Attachments:
Posted on 2005-05-14 02:21:57 by purpleendurer
If you have a static library, us the standard MASM syntax of INCLUDE for the prototypes and INCLUDELIB for the library. If it is an export library you must have the DLL present or you will get a runtime error about the missing DLL.
Posted on 2005-05-14 02:25:42 by hutch--
Thanks hutch--

I include the scrnsave.inc and scrnsave.lib in my source file:

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\comctl32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\gdi32.inc
include \masm32\include\advapi32.inc
include \masm32\include\shell32.inc
include \masm32\include\scrnsave.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\scrnsave.lib
includelib \masm32\lib\msvcrt.lib



My program can build successfully in QEDITOR.EXE, but run the program, I was prompted that missed scrnsave.dll
Posted on 2005-05-14 02:48:15 by purpleendurer
Your scrnsave.lib is probably broken, try with the attached one.
Attachments:
Posted on 2005-05-14 15:18:17 by thefox
Thanks hutch-- and thefox  very much....

At first, I found the scrnsave.lib in \masm32\lib, It's length is 14,980 bytes,
and the length of scrnsave.lib  thefox attached is 37,900 bytes,

I renamed the old scrnsave.lib  to scrnsave0.lib, down and unziped  scrnsave.lib that thefox attached  to \masm32\lib

then builded my program in QEDITOR.EXE, an link error message gived:


Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: D:\masm32\myworks\scrsaver\1.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : fatal error LNK1104: cannot open file "\masm32\lib\msvcrt.lib"
_
Link error
??????? . . .


I found msvcrt.lib in VC6, and copied it to \masm32\lib,

builded my program in QEDITOR again, It was successful this time.

the attached file is msvcrt.lib of VC6
Attachments:
Posted on 2005-05-15 02:10:35 by purpleendurer
Just for your information, the scrnsave.lib I attached is from Microsoft Visual C++ 6 also :)
Posted on 2005-05-15 16:48:48 by thefox
The problem with the MASM32 .lib files is that they only work for DLL modules, since they're built from the .inc files. However, a number of libraries from the PlatformSDK includes code/data as well as imports - including, but not limited to, scrnsave.lib .
Posted on 2005-05-17 08:08:32 by f0dder