flat assembler
Message board for the users of flat assembler.

Index > Windows > How to Complie and linking?

Author
Thread Post new topic Reply to topic
cksac



Joined: 28 Jun 2009
Posts: 2
cksac
//HERE IS THE main.c
#include <stdio.h>

int sum(int a,int b);

int main()
{
int result;;

result = sum(150,350);
printf("The sum is %d\n",result);
return(0);
}

;HERE IS THE sum.asm in NASM
segment data

segment bss

segment text
global sum
sum:
push ebp
mov ebp,esp
push ebx

mov ebx,[ebp+8]
add ebx,[ebp+12]

mov eax,ebx ; return value
pop ebx
mov esp,ebp
pop ebp
ret

I know how to complie and linking in linux. My Q is how to do the same thing in windows using FASM
Post 28 Jun 2009, 15:38
View user's profile Send private message Reply with quote
Icefex



Joined: 11 Feb 2009
Posts: 17
Icefex
Well, I would say, make a coff ( .obj) out of your sum.asm and link it to your main. For compiling the c file you should use mingw or cygwin. afaik there are samples of coff in the fasm win32 package.
Post 28 Jun 2009, 15:50
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
look at "High Level Languages" section of this forum, into "About this section" thread, and follow to examples.
Post 28 Jun 2009, 19:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
cksac



Joined: 28 Jun 2009
Posts: 2
cksac
Thanks vid for pointing me to the right place. It helps!
Post 29 Jun 2009, 05:18
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.