flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Windows > Linking FASM MS64 COFF static object with GCC | 
  
| Author | 
  | 
              
| 
                  
                   system error 09 Apr 2016, 07:27 
                  For comparison. this is the 32-bit version that works
 
                  
                Code: ;gcc test.obj -o test.exe format MS COFF public main as '_main' extrn _printf main: push ebp mov ebp,esp push msg call _printf add esp,4 sub esp,8 push [x] fld dword[x] fstp qword[esp] push fmt call _printf add esp,12 mov esp,ebp pop ebp ret x dd -0.1756522 fmt db '%f',0 msg db 'Hello World LOL LOL',0ah,0  | 
              |||
                  
  | 
              
| 
                  
                   eeikel 14 Apr 2016, 09:32 
                  in c: void aFunction();
 
                  
                Code: format MS64 COFF public aFunction section '.data' data readable writeable align 16 the_x dq -0.1756522 fmt db '%f',0 msg db 'Hello World',0ah,0 section '.code' code readable executable ;align 16 extrn 'printf' as _printf aFunction: sub rsp,32 mov rcx,msg call _printf movq xmm0, [the_x] mov rcx, fmt ; rcx returned value call _printf add rsp,32 ret  | 
              |||
                  
  | 
              
| 
                  
                   system error 15 Apr 2016, 07:35 
                  thanks man. But when I use GCC, shouldn't I comply to the C structure (main, _main, WinMain@xyxyxyxyxyxyzz, mainCRTStartup and stuff)? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   eeikel 15 Apr 2016, 08:11 
                  No you just do in c:
 
                  
                Code: void aFunction(); int main(){ aFunction(); return 0; } link the file test.OBJ in eclipse project -> properties -> c/c++ build -> tab: tool settings -> mingWC linker -> Miscellanious -> other objects  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.