×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

library in masm

library in masm

library in masm

(OP)
Hi, I have an assignment which is to build a library of some routines in assembly. Does anybody know how the main program (that calls the routines) and the program (library
file) which includes the routines sould be?I mean their syntax. I use masm611 and i made a library file with the ms-lib utility, but when i use ML to assemble the main programm the linker finds problems in the lib file. When i assemble the routines .asm file there are no errors.Also when i make the library with lib there are no error messages. I just wonder if there are some directives which ignore.Please i need help !!!

RE: library in masm

(OP)
When i try to compile the main program that calls routines from the libray i get an "error A2206: missing operator in expression" for the programm line of the call instruction. The lib file is put in the lib directory of masm611. I used the public directive with no results at both modules. Can anybody show me a working example of two programms, one for the library and one for the main programm that calls routines from the library? Please help.

RE: library in masm

djdeath,

I hope this will work with MASM611.

This is a LIB example. Name the file as "msgbox.asm"

    .386
    .model flat, stdcall
    option casemap :none   ; case sensitive

    include \masm32\include\windows.inc
    include \masm32\include\user32.inc

    includelib \masm32\lib\user32.lib

.CODE
  MBox proc MB_Message:LPSTR, MB_Title:LPSTR
    invoke MessageBox, NULL, \
      MB_Message, MB_Title, MB_ICONINFORMATION
    ret
  MBox endp
END

Build it using this command (change the masm32 path to your masm folder) :
c:\masm32\bin\ml /c /coff MsgBox.asm
c:\masm32\bin\link -lib *.obj /out:MsgBox.lib


Main program ( call_MBox.asm ):

      .386
      .model flat, stdcall
      option casemap :none   ; case sensitive

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

      includelib MSGBOX.LIB         ; This is our library

      ; Declare the function prototype from our library
      MBox PROTO :LPSTR, :LPSTR

.DATA
   cMsg     db 'My Message',0
   cTitle   db 'My Title',0

.CODE
Start:
   invoke MBox, Addr cMsg, Addr cTitle
   invoke ExitProcess, 0
END Start

Build:
\masm32\bin\ml /c /coff Call_MBox.asm
\masm32\bin\Link /nologo /SUBSYSTEM:WINDOWS Call_MBox.obj


Hope it helps

-- AirCon --

RE: library in masm

(OP)
Thank you very much aircon for your help i shall try it tomorrow.

RE: library in masm

(OP)
Unfortunately it doesn't work in masm611 at "c:\masm32\bin\link -lib *.obj /out:MsgBox.lib" command there is a "/out : unrecognised option name ; option ignored. I'll try to tweak it in order to get it work. But does anybody has another example for masm611.

RE: library in masm

Try to build with this:

LIB *.obj /out:msgbox.lib

-- AirCon --

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close