The MASM Forum

General => The Campus => Topic started by: xandaz on November 15, 2021, 09:30:51 AM

Title: Trouble with LIB.exe
Post by: xandaz on November 15, 2021, 09:30:51 AM
    i have this batch job:@echo off
if exist %1.lib del %1.lib
\masm32\bin\lib.exe %1.obj
dir %1.*
pause

for some reason lib.exe cant find any inpute file. The code i had written was:   .elseif ax==IDM_OBJ2LIB
              invoke  GetCurrentDirectory,sizeof szInitialDir,addr szInitialDir
invoke SendMessage,hMdi,WM_MDIGETACTIVE,0,0
invoke GetWindowText,eax,addr TempBuffer,MAX_PATH
lea esi,TempBuffer
cld
loop_3:
    lodsw
cmp al,'.'
jne loop_3
sub esi,2
mov word ptr [esi],0
invoke ShellExecute,hWnd,addr szShellOpen,addr szObject2Lib,addr TempBuffer,\
addr szInitialDir,SW_SHOWNORMAL
can someone help me out?
Title: Re: Trouble with LIB.exe
Post by: TimoVJL on November 15, 2021, 08:24:48 PM
What kind of path-names are, are there spaces in it ? If so, use quotechars in batchfile.
Title: Re: Trouble with LIB.exe
Post by: xandaz on November 16, 2021, 03:18:13 AM
   Thanks JJ. Quoting worked fine but stll the order of commands takes place disordered. Why the hell is that?@echo off
if exist %1.lib del %1.lib
\masm32\bin\lib.exe "%1.obj"
dir %1.*
pause

Dir %1.* takes place before the Lib.exe execution. I had to make a second Dir %1.* command@echo off
if exist %1.lib del %1.lib
\masm32\bin\lib.exe "%1.obj"
dir %1.*
pause
dir %1.*
pause
Title: Re: Trouble with LIB.exe
Post by: xandaz on November 16, 2021, 05:24:04 AM
   I am in trouble. Can any one post an example of a Static library? Are there any command line options one should use when assembling? Thanks
Title: Re: Trouble with LIB.exe
Post by: xandaz on November 16, 2021, 05:53:28 AM
   Nevermind i was using include instead of includelib
Title: Re: Trouble with LIB.exe
Post by: fearless on November 16, 2021, 05:58:02 AM
Make sure your lib ends with:

END

and not

END Start


Take out the Start label from the library

use INCLUDELIB instead of INCLUDE in your test proc

Ideally you might also create an .inc file to pair with your .lib file for other user to include, that has the function prototypes and any structures or other public information required - even some basic comments on usage etc
Title: Re: Trouble with LIB.exe
Post by: xandaz on November 16, 2021, 06:00:34 AM
    Thanks fearless. I know understand how its done.