User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 373,573 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,847 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser:
Apr 26th, 2006
Views: 2,352
FASM can output an executable PE directly, but sometimes you want to output an object file for linking with modules in other languages. The following program can be used to link with the C library of the GCC compiler with the following commands:

C:\>fasm hello.asm hello.obj
C:\>gcc hello.obj -o hello.exe

It's almost like magic!
fasm Syntax
  1. format MS COFF
  2.  
  3. include 'C:\fasm\include\win32a.inc'
  4.  
  5. ;======================================
  6. section '.data' data readable writeable
  7. ;======================================
  8.  
  9. hello_msg db 'Hello, world!',0
  10.  
  11. ;=======================================
  12. section '.text' code readable executable
  13. ;=======================================
  14.  
  15. public _main
  16. extrn '_printf' as printf
  17.  
  18.  
  19. _main:
  20. ccall printf,hello_msg
  21. xor eax,eax
  22. ret
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 7:43 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC