Course Hero Logo

How the linker works w hat is a l ink l ibrary a file

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 50 - 60 out of 82 pages.

¢How the Linker Works
WHAT IS ALINKLIBRARY?¢A file containing procedures that have beencompiled into machine codeconstructed from one or more OBJ files¢To build a library, . . .start with one or more ASM source filesassemble each into an OBJ filecreate an empty library file (extension .LIB)add the OBJ file(s) to the library file, using theMicrosoft LIB utility
HOWTHELINKERWORKS¢Your programs link to Irvine32.lib using the linker commandinside a batch file named make32.bat.¢Notice the two LIB files: Irvine32.lib, and kernel32.libthe latter is part of the MicrosoftWin32 SoftwareDevelopment Kit (SDK)Your programkernel32.libkernel32.dllIrvine32.liblinksexecutestolinks tocan link to
ADD IRVINE32.LIB¢Configuration Properties->Inputentry, and insertirvine32.lib;at the beginning of theAdditionalDependenciesentry.
ADD C:\IRVINE TO LINKER LIBRARY¢SelectLinkerunder Configuration Properties, andthen selectGeneral. TheAdditional LibraryDirectoriesentry must containc:\Irvineso the linkercan find the Irvine32.lib library file:
WHAT'SNEXT¢Stack Operations¢Defining and Using Procedures¢Linking to an External Library¢The Irvine32 Library¢64-Bit Assembly Programming
CALLINGIRVINE32 LIBRARYPROCEDURESINCLUDE Irvine32.inc.codemoveax,1234h; input argumentcall WriteHex; show hex numbercall Crlf; end of lineCall each procedure using the CALL instruction. Someprocedures require input arguments. The INCLUDE directivecopies in the procedure prototypes (declarations).The following example displays "1234" on the console:
LIBRARYPROCEDURES- OVERVIEW(1OF5)CloseFile– Closes an open disk fileClrscr- Clears console, locates cursor at upper left cornerCreateOutputFile- Creates new disk file for writing in output modeCrlf- Writes end of line sequence to standard outputDelay- Pauses program execution fornmillisecond intervalDumpMem- Writes block of memory to standard output in hexDumpRegs– Displays general-purpose registers and flags (hex)GetCommandtail- Copies command-line args into array of bytesGetDateTime– Gets the current date and time from the systemGetMaxXY- Gets number of cols, rows in console window bufferGetMseconds- Returns milliseconds elapsed since midnight
LIBRARYPROCEDURES- OVERVIEW(2OF5)GetTextColor- Returns active foreground and background text colors inthe console windowGotoxy- Locates cursor at row and column on the consoleIsDigit- Sets Zero flag if AL contains ASCII code for decimal digit (0–9)MsgBox, MsgBoxAsk– Display popup message boxesOpenInputFile– Opens existing file for inputParseDecimal32– Converts unsigned integer string to binaryParseInteger32- Converts signed integer string to binaryRandom32- Generates 32-bit pseudorandom integer in the range 0 toFFFFFFFFhRandomize- Seeds the random number generatorRandomRange- Generates a pseudorandom integer within a specifiedrangeReadChar- Reads a single character from standard input
LIBRARYPROCEDURES- OVERVIEW(3OF5)ReadDec- Reads 32-bit unsigned decimal integer from keyboard

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 82 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
tony chern
Tags
Call stack, ESI, Stack Operations

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture