On Sun, Aug 28, 2005 at 09:45:26PM -0700, Matthew Dillon wrote:
: 
: :
: :Is there a trick to calling malloc from NASM code?  It links fine and steps
: :into malloc() fine, but returns a NULL pointer.
: 
:     Nope, should work just fine.  The assembly should look something like
:     this (assuming we are talking about a userland program here):
: 
:     pushl     $bytes_to_malloc
:     call      malloc
:     addl      $4,%esp
:     [ returns pointer in %eax ]

That's exactly what I thought.  And it works fine with gas.  But under NASM, I
get a NULL pointer returned.  It steps into malloc, but doesn't return a mem
pointer.

Jonathon McKitrick
--
Hoppiness is a good beer.

Reply via email to