Author Topic: Trouble with LIB.exe  (Read 1320 times)

xandaz

  • Member
  • ****
  • Posts: 529
  • I luv you babe
    • My asm examples
Trouble with LIB.exe
« on: November 15, 2021, 09:30:51 AM »
    i have this batch job:
Code: [Select]
@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:
Code: [Select]
  .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?

TimoVJL

  • Member
  • *****
  • Posts: 1320
Re: Trouble with LIB.exe
« Reply #1 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.
« Last Edit: November 16, 2021, 04:34:06 AM by TimoVJL »
May the source be with you

xandaz

  • Member
  • ****
  • Posts: 529
  • I luv you babe
    • My asm examples
Re: Trouble with LIB.exe
« Reply #2 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?
Code: [Select]
@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
Code: [Select]
@echo off
if exist %1.lib del %1.lib
\masm32\bin\lib.exe "%1.obj"
dir %1.*
pause
dir %1.*
pause

xandaz

  • Member
  • ****
  • Posts: 529
  • I luv you babe
    • My asm examples
Re: Trouble with LIB.exe
« Reply #3 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

xandaz

  • Member
  • ****
  • Posts: 529
  • I luv you babe
    • My asm examples
Re: Trouble with LIB.exe
« Reply #4 on: November 16, 2021, 05:53:28 AM »
   Nevermind i was using include instead of includelib

fearless

  • Member
  • ****
  • Posts: 578
    • Github
Re: Trouble with LIB.exe
« Reply #5 on: November 16, 2021, 05:58:02 AM »
Make sure your lib ends with:

Code: [Select]
END
and not

Code: [Select]
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
fearless

ASUS Crosshair 8 Hero, AMD 5950X, 32GB, MSI 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

Github Twitter Mastodon Gitbook

xandaz

  • Member
  • ****
  • Posts: 529
  • I luv you babe
    • My asm examples
Re: Trouble with LIB.exe
« Reply #6 on: November 16, 2021, 06:00:34 AM »
    Thanks fearless. I know understand how its done.