Author Topic: Linux/NASM Tutorials  (Read 18058 times)

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 430
  • Country: us
Re: Linux/NASM Tutorials
« Reply #15 on: September 19, 2012, 04:07:47 PM »
Damn swear filter!

It appears that the filter does not function at 100% efficiency!  ;D

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2373
  • Country: us
Re: Linux/NASM Tutorials
« Reply #16 on: September 21, 2012, 07:22:21 PM »
Expletive deleted good job, Gunner! Battle to the end!

The distributed executable dies with "floating point exception" on my system. Haven't looked into why. Been lazy lately. ("lately"?... "as usual"!). "error: system too obsolete" probably... Thanks!

Best,
Frank


Offline Gunner

  • Jr. Member
  • *
  • Posts: 74
  • Country: us
    • Gunners Software
Re: Linux/NASM Tutorials
« Reply #17 on: September 23, 2012, 04:06:20 PM »
Unsure why.  As I pointed out in the tut, there is absolutely no error checking to keep it simple.  I do know that error comes from somewhere in the GTK libs.

Glad to be of help :-)

Offline Mathi

  • Jr. Member
  • *
  • Posts: 79
  • Country: in
    • Win32NASM
Re: Linux/NASM Tutorials
« Reply #18 on: October 07, 2012, 07:24:20 PM »
"Cross OS App for Linux/Windows using GTK" idea really inspired me.

I have created an include file for gtk (gtk.inc) and hll.inc (mostly useful generic macros from nagoa+.inc) in the hope that Gtk programs written using this can be compiled and executed in both platforms without any change.

I have attached the zip file containing
gtkwin.asm
hll.inc
gtk.inc

I have validated these in windows, but i don't have access to linux now, It would be great if Gunner or someone can validate this in linux and update.

For windows All you need is nasm, golink and the gtk runtime dlls.
You can visit
http://www.gtk.org/download/win32.php
to get the runtime dlls or download from
http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip

Extract the dlls from the zip file to windows\system32 folder so that golink can find them. It worked for me :)
(The program displays a window with two controls and a pop up.)

The example program(gtkwin.asm) is translated from the following C Version.
Code: [Select]
#include <windows.h>
#include <gtk/gtk.h>

static GtkWidget *entry;
GtkWidget *window;
static gboolean kill_window(GtkWidget *widget, GdkEvent *event, gpointer data)
{
gtk_main_quit();
return FALSE;

}

static void button_press(GtkWidget *widget, gpointer data)
{
const char *text = gtk_entry_get_text(GTK_ENTRY(entry));
GtkWidget *msgbox;
msgbox = gtk_message_dialog_new(window,GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO ,GTK_BUTTONS_OK ,text);
gtk_window_set_title(GTK_WINDOW(msgbox), "Info");
gtk_dialog_run(GTK_DIALOG(msgbox));
gtk_widget_destroy(msgbox);

}

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{

GtkWidget *button;
GtkWidget *hbox;

gtk_init_abi_check(NULL, NULL,2,sizeof(GtkWindow),sizeof(GtkBox));
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

button = gtk_button_new_with_label("Echo");
entry = gtk_entry_new();
hbox = gtk_hbox_new(FALSE, 2);

gtk_window_set_title(GTK_WINDOW(window), "GTK application");

g_signal_connect_data (window, "delete_event", G_CALLBACK(kill_window), NULL, NULL, (GConnectFlags) 0);

g_signal_connect_data (button, "clicked", G_CALLBACK(button_press), NULL, NULL, (GConnectFlags) 0);
gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 2);
gtk_container_add(GTK_CONTAINER(window), hbox);

gtk_widget_show_all(window);

gtk_main();
gtk_exit(0);

return 0;
}

I have not tried linking gtk programs written in nasm in linux before. i could use someone's help now.

Thanks,
Mathi.

Offline Gunner

  • Jr. Member
  • *
  • Posts: 74
  • Country: us
    • Gunners Software
Re: Linux/NASM Tutorials
« Reply #19 on: May 01, 2013, 03:57:55 AM »
Ok, finally gotten around to writing the SQLite tutorial.  There will be a few tutorials on this as I have time.  This part shows how to get data from a table 2 ways.

NASM - Using SQLite (Querying data from a table)

Offline Gerhard

  • Jr. Member
  • *
  • Posts: 50
Re: Linux/NASM Tutorials
« Reply #20 on: May 01, 2013, 09:58:21 AM »
Hi Gunner,

your tutorials are very good. Thzank you for that.

Gerhard