flat assembler
Message board for the users of flat assembler.
Index
> Linux > Any GTK2.0 /2.1 examples with FASM |
Author |
|
pelaillo 04 Apr 2011, 18:18
This is a template for GTK generic application.
It's intended for multiplatform development. The same sources must work in supported platforms (currently Linux and Win32). I have abandoned the project because FreshLib provides a more comfortable solution for my needs and without the bulk of GTK libraries
|
|||||||||||
04 Apr 2011, 18:18 |
|
surgeon 08 Apr 2011, 04:25
I have GTK 2.1 installed on my CentOS linux box but the above file refused to work. i am really green on mixing assemly and other languages , can someone direct me to a link or a pointer on how to translate C header files to work with Assembly, or importing DLLs and all that .
|
|||
08 Apr 2011, 04:25 |
|
ProphetOfDoom 09 Apr 2011, 19:46
Hi. I don't actually use gtk much at present but I had a book on the subject lying around so I translated the hello world application for you. I'd be very surprised if it doesn't work - it's about the simplest gtk app you can write.
Code: format ELF extrn exit extrn gtk_init extrn gtk_window_new extrn gtk_window_set_title extrn gtk_widget_show extrn gtk_main extrn printf public main GTK_WINDOW_TOPLEVEL = 0 section '.data' writeable window dd 0 hello db "Hello world.",0 section '.text' executable main: push ebp mov ebp, esp lea eax, [ebp + 12] push eax lea eax, [ebp + 8] push eax call gtk_init add esp, 8 push GTK_WINDOW_TOPLEVEL call gtk_window_new add esp, 4 mov [window], eax push hello push [window] call gtk_window_set_title add esp, 8 push [window] call gtk_widget_show add esp, 4 call gtk_main push 0 call exit To assemble: Code: fasm gtk.asm Link: Code: gcc gtk.o `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` Execute: Code:
./a.out
I'm basing the arguments of the first call (to gtk_init) on the assumption that argc and argv are located at ebp + 8. I discovered that from looking at the assembly output from a C program. Hopefully it's the same across distros. The only other possible problems i can forsee are that you may need to install the program pkg-config, and you may need to change gtk+-2.0 to gtk+-2.1. Also you have to kill the resulting program with CTRL-C because it doesn't handle messages. Hope that helps. |
|||
09 Apr 2011, 19:46 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.