flat assembler
Message board for the users of flat assembler.

Index > Linux > malloc(c/c++) to asm

Author
Thread Post new topic Reply to topic
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 23 Mar 2011, 03:25
hi all;
i've make a small program in linux(asm source), i use syscall(int 0x80) in most case to IO program, but i can only used sys_write and sys_read, sys_lseek. a problem when i progress in file IO, i can know file size but don't know how to alloc memory, somebody can tell me how to do that

_________________
sorry for my english
Post 23 Mar 2011, 03:25
View user's profile Send private message Yahoo Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 23 Mar 2011, 05:31
You can use libc from your source. You need to import needed functions from the dynamic libraries. (As a variant - you can compile to object file and then to link to the static c libraries).
You can download FreshLib sources from here
The documentation is published here
You can choose to use the FreshLib to access files as well as memory allocations - in result you will have portable application for Win32 and Linux.
On the other hand, you simply can use Linux import macros to import functions you need.

Regards
Post 23 Mar 2011, 05:31
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 23 Mar 2011, 05:38
Since you seem to want to use syscalls exclusively, you may want to look at brk() and mmap() with the MAP_ANONYMOUS and MAP_PRIVATE flags.
Post 23 Mar 2011, 05:38
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Mar 2011, 14:43
Post 23 Mar 2011, 14:43
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 25 Mar 2011, 09:42
thank for all
Post 25 Mar 2011, 09:42
View user's profile Send private message Yahoo Messenger 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.