flat assembler
Message board for the users of flat assembler.

Index > Linux > gtk corect widgets

Author
Thread Post new topic Reply to topic
catafest



Joined: 05 Aug 2010
Posts: 120
catafest
The problems is how to use correct gtk widgets with fasm.
I try one example with just one widget "Entry".
The window is ok , but the widget entry is not show.
Also i try to add one vbox to show it ( I think is need to entry widget).
Code:
format ELF

extrn exit
extrn gtk_init
extrn gtk_window_new
extrn gtk_window_set_title
extrn gtk_entry_new
extrn gtk_vbox_new
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 + 16]
push eax
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
call gtk_vbox_new
add esp, 12
call gtk_entry_new
add esp, 16

push [window]
call gtk_widget_show
add esp, 4

call gtk_main

push 0
call exit
    
Post 07 Jan 2012, 13:20
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
cvtss2sd



Joined: 30 Sep 2010
Posts: 48
cvtss2sd
I'm not sure i'm following your code correctly.... Could you comment in your intended parameters for each call? (Remember, too, that calls don't unload the stack for you.)
Post 28 Jan 2012, 06:18
View user's profile Send private message Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 120
catafest
I'm not very good with fasm and linux.
But , I try to use a complex example with: gtk_entry_new and gtk_vbox_new .
I read a C code and a simple fasm with gtk_window_new ( is on this forum ).
I'm sure is a error , but I d'ont know the way to use: extrn gtk_entry_new
When I use the stack,it is need to put something?
Maybe yes but how ?
Thank you.
Post 28 Jan 2012, 07:59
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
cvtss2sd



Joined: 30 Sep 2010
Posts: 48
cvtss2sd
It'd be easier to say that you need to compare the output of the following to your code (the syntax is different, but you'll see a difference):

Code:
gcc -S -o gas.asm name_of_c_example.c    
Post 28 Jan 2012, 10:18
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
(Not tested)
Code:
gcc -S -masm=intel -o gas.asm name_of_c_example.c    
This should give you a more familiar x86 assembly syntax.
Post 30 Jan 2012, 15:06
View user's profile Send private message 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-2020, Tomasz Grysztar.

Powered by rwasa.