flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Projects and Ideas > vb script process nm.exe output for MS COFF extrn [DONE] | 
| Author | 
 | 
| sleepsleep 17 Jun 2012, 15:49 hi,
 this vb script will certainly help those who want to ld static link MinGW .a files with MS COFF output using Fasm. http://obemsg.blogspot.com/2012/06/nmexe-output-extrn-for-fasm.html to get list of functions of a .a file, use nm.exe ( available inside MinGW bin ) eg: D:\MinGW\lib>nm -g libuser32.a > C:\nmlibuser32.txt to parse the output file into proper extrn eg: ANSI C:\>cscript.exe /nologo nm2extern.vbs C:\nmlibuser32.txt > libuser32a.inc UNICODE C:\>cscript.exe /nologo nm2extern.vbs C:\nmlibuser32.txt 1 > libuser32w.inc version 2012-06-18-21-54 this version support those api that without @ eg. 00000000 I __imp__iupdrvWarpPointer example output Code: ANSI extrn '__imp__wvsprintfA@12' as wvsprintf:dword extrn '__imp__mouse_event@20' as mouse_event:dword extrn '__imp__keybd_event@16' as keybd_event:dword extrn '__imp__WindowFromPoint@8' as WindowFromPoint:dword extrn '__imp__WindowFromDC@4' as WindowFromDC:dword extrn '__imp__WinHelpA@16' as WinHelp:dword extrn '__imp__WaitMessage@0' as WaitMessage:dword extrn '__imp__WaitForInputIdle@8' as WaitForInputIdle:dword extrn '__imp__VkKeyScanExA@8' as VkKeyScanEx:dword extrn '__imp__VkKeyScanA@4' as VkKeyScan:dword UNICODE extrn '__imp__wvsprintfW@12' as wvsprintf:dword extrn '__imp__mouse_event@20' as mouse_event:dword extrn '__imp__keybd_event@16' as keybd_event:dword extrn '__imp__WindowFromPoint@8' as WindowFromPoint:dword extrn '__imp__WindowFromDC@4' as WindowFromDC:dword extrn '__imp__WinHelpW@16' as WinHelp:dword extrn '__imp__WaitMessage@0' as WaitMessage:dword extrn '__imp__WaitForInputIdle@8' as WaitForInputIdle:dword extrn '__imp__VkKeyScanW@4' as VkKeyScan:dword extrn '__imp__VkKeyScanExW@8' as VkKeyScanEx:dword 
 Last edited by sleepsleep on 18 Jun 2012, 14:34; edited 6 times in total | |||||||||||
|  17 Jun 2012, 15:49 | 
 | 
| sleepsleep 18 Jun 2012, 12:14 it seems extrn everything will cause our application grow large,
 could anyone code a macro to include extrn based on what api found inside our asm code? | |||
|  18 Jun 2012, 12:14 | 
 | 
| revolution 18 Jun 2012, 12:17 That would seem to be easy (untested):     Code: macro extrn text, name, type { if used name extrn text as name:type end if } | |||
|  18 Jun 2012, 12:17 | 
 | 
| sleepsleep 18 Jun 2012, 12:21 Code: format MS COFF include 'win32ax.inc' macro extrn text, name, type { if used name extrn text as name:type end if } include 'libkernel32axp.inc' include 'libuser32axp.inc' section '.text' code readable executable public _demo Code: flat assembler version 1.70.02 (1572863 kilobytes memory) D:\Fasm\INCLUDE/libkernel32axp.inc [1]: extrn '__imp__lstrlenA@4' as lstrlen:dword MSCOFF.ASM [8] extrn [1]: if used name error: invalid expression. make: *** [MSCOFF.OBJ] Error 2 ? | |||
|  18 Jun 2012, 12:21 | 
 | 
| sleepsleep 18 Jun 2012, 12:22 or revolution, you want me to change the format of those extern file? | |||
|  18 Jun 2012, 12:22 | 
 | 
| revolution 18 Jun 2012, 12:30 Oh. Try this:     Code: macro extrn stuff { match text =as name:type,stuff \{ if used name extrn text as name:type end if \} } | |||
|  18 Jun 2012, 12:30 | 
 | 
| sleepsleep 18 Jun 2012, 12:34 awesome, it seems works!!!!
 damn it, i edit the xp api manually one by one yesterday night, LMFAO... | |||
|  18 Jun 2012, 12:34 | 
 | 
| revolution 18 Jun 2012, 12:46 sleepsleep wrote: damn it, i edit the xp api manually one by one yesterday night, LMFAO... | |||
|  18 Jun 2012, 12:46 | 
 | 
| sleepsleep 18 Jun 2012, 12:47 gonna start understand how those macro works.
 btw, thanks!!  it just awesome! | |||
|  18 Jun 2012, 12:47 | 
 | 
| rugxulo 05 Jul 2012, 21:17 s/When all else fails, read the source/Never underestimate the power of the macro./
  | |||
|  05 Jul 2012, 21:17 | 
 | 
| revolution 06 Jul 2012, 13:00 rugxulo wrote: s/When all else fails, read the source/Never underestimate the power of the macro./ s/When all else fails, read the source/When all else fails, read the instructions/ | |||
|  06 Jul 2012, 13:00 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.