flat assembler
Message board for the users of flat assembler.

Index > Linux > gcc and fasm

Author
Thread Post new topic Reply to topic
realcr



Joined: 02 Apr 2007
Posts: 39
realcr 12 May 2007, 12:07
Hey everyone.
I wrote a C program , and I wanted to implement one of the functions in the program using fasm. I was wondering how can I link the C obj file to the fasm obj. What should I add in the c file?
I tried exporting functions in the C code but non of it worked. I will be more than happy if anyone has got a simple example for that.

thanks,
bar.
Post 12 May 2007, 12:07
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
hidden



Joined: 14 Feb 2007
Posts: 49
hidden 12 May 2007, 17:46
Code:
#include <stdio.h>

int shl(int,int);

int main( void )
{
  printf("%d", shl(0x100, 2));
  return 0;
}    
Code:
format MS COFF

include 'MACRO\PROC32.INC'

public _shl

section '.text' code readable executable

proc _shl c, a, b
      mov     eax, [a]
    mov     ecx, [b]
    shl     eax, cl
     ret
endp    
Post 12 May 2007, 17:46
View user's profile Send private message Reply with quote
realcr



Joined: 02 Apr 2007
Posts: 39
realcr 12 May 2007, 18:01
Wow. really nice.

great thanks hidden.

[edit]

I was wondering if the MACRO thingy also comes with the linux version for fasm. I don't seem to have it on mine.
Post 12 May 2007, 18:01
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
hidden



Joined: 14 Feb 2007
Posts: 49
hidden 12 May 2007, 20:25
realcr wrote:
I was wondering if the MACRO thingy also comes with the linux version for fasm. I don't seem to have it on mine.
You can use macros that goes with windows version as well, but somewhere on this forum I saw a topic about it, you can try to find it.

_________________
Image Lang: (eng|рус)
Post 12 May 2007, 20:25
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.