Confusion from Win32 -> Linux 64-bit assembly
Posted: Mon Dec 17, 2007 6:09 pm
Hello. I suppose I should introduce myself as well, considering this is my first post. I'm a hobbyist programmer (I'm going to go to college for a CE/CS degree, however), with C, C++, and Java experience. I've recently taken up Assembly as a new programming language, as a result of a newfound interest in computer engineering
I started off with masm32, got a little too used to the invoke syntax, and then ended up moving to nasm after I found the license for masm32 to be incompatible with my plans. I then learned the Win32 way of calling functions, such as (this is an example of some of the libsdl bindings I worked with)
However, I've noticed this does not work very well on Linux 64-bit. I've tried the push/call method, and it doesn't work at all. All my calls are being executed, but I'm not sending the data in the right manner. In fact, if I try that same code on Nasm 2.00, x86_64, I end up completely freezing my window manager! (I do have SDL_Quit in there, so that's not the problem)
Also, one question about something that's been bugging me for quite a while. I've noticed that .lib files that are normally used in Microsoft programming projects are a lot better at producing small code that's easily debuggable, but the static linking that comes with using libc makes it confusing to find the entry point of an assembled binary. Is there any way to dynamically link to libc?
I started off with masm32, got a little too used to the invoke syntax, and then ended up moving to nasm after I found the license for masm32 to be incompatible with my plans. I then learned the Win32 way of calling functions, such as (this is an example of some of the libsdl bindings I worked with)
Code: Select all
push dword SDL_INIT_EVERYTHING
call SDL_Init
push dword 0
push dword 32 ; bits per pixel
push dword 480 ; resolution, x
push dword 640 ; resolution, y
call SDL_SetVideoMode
; etc etc
Also, one question about something that's been bugging me for quite a while. I've noticed that .lib files that are normally used in Microsoft programming projects are a lot better at producing small code that's easily debuggable, but the static linking that comes with using libc makes it confusing to find the entry point of an assembled binary. Is there any way to dynamically link to libc?