Click to See Complete Forum and Search --> : dynamically allocating memory for a variable


GeoHoffman49431
April 6th, 2006, 10:30 PM
This is in assembly for sparc. I can call c functions though.


How do I dynamically allocate memory for a variable from within the assembly code? Do I have to call malloc? Is there another, pure assembly way, to do so or would it be too much of a hassle?

xoclipse
April 11th, 2006, 01:29 AM
Calling malloc would definitely be your best bet. You could probably hand write in assembly what malloc does, but what would be the point in that?

Just call malloc, get the pointer to the memory, and do whatever you need with it.