[Glade-users] LibGlade, mingw32, crosscompiling linux->windows, signal handlers



hi there, 

The short answer:
step1 export every handler 
step2 .o => .def
step3 .def + .o =>  .exp
step4 add the .exp file when you link the program

The long answer it's a simple example :)

----- start main.c 
#include <glade/glade.h>
#include <gtk/gtk.h>
#define EXPORT __declspec (dllexport)

EXPORT void on_button1_clicked( GtkButton *widget,
gpointer user_data) {
    g_print( "it works !\n" );
}

int main( int argc, char **argv) {
    GladeXML *xml;
    gtk_init( &argc, &argv );
    xml = glade_xml_new( "simple.glade", NULL, NULL);
    glade_xml_signal_autoconnect( xml );
    gtk_main();
    return 0;
}
~  
----- end   main.c 
 
----- start Makefile
CC   = gcc.exe

BIN = simple.exe
SRC = main.c
OBJ = $(SRC:.c=.o)
DEF = $(SRC:.c=.def)
EXP = $(SRC:.c=.exp)

CFLAGS = -Wall -DDEBUG -mno-cygwin  -mms-bitfields
CFLAGS +=  -I"D:/DEVCPP/include" 
-I"D:/devextra/include" 
-I"D:/devextra/include/gtk-2.0
"  -I"D:/devextra/include/glib-2.0"
-I"D:/devextra/include/atk-1.0"  -I"D:/devextra/incl
ude/pango-1.0"  -I"D:/devextra/lib/glib-2.0/include" 
-I"D:/devextra/lib/gtk-2.0/include"
  -I"D:/devextra/include/libglade-2.0"

LIBS =  -Wl,--export-dynamic -L"D:/DEVCPP/lib"
-L"D:/devextra/lib" -lglade-2.0 -lgtk-win32-2.0 
-lgdk-win32-2.0  -lgthread-2.0  -lgdi32  -lole32 
-luuid  -latk-1.0  -lgdk_pixbuf-2.0  -lpangowin32-1.0 
-lgdi32  -lpango-1.0  -lgobject-2.0  -lgmodule-2.0 
-lglib-2.0  -lintl  -liconv


all: $(BIN)

$(BIN): $(OBJ) $(EXP)
    $(CC) -o $(BIN) $(OBJ) $(EXP) $(LIBS)

   
$(EXP): $(OBJ) $(DEF)
    dlltool --dllname $(BIN) --def $(DEF) 
--output-exp $(EXP)

$(DEF): $(OBJ)
    dlltool --output-def $(DEF) $(OBJ)
    
.c.o:
    $(CC) -c $(CFLAGS) -o $@ $<

clean: 
    rm -f $(BIN) $(OBJ) $(DEF) $(EXP) 

----- end   Makefile

 
----- start simple.glade
<?xml version="1.0" standalone="no"?> <!--*- mode: xml
-*-->
<!DOCTYPE glade-interface SYSTEM
"http://glade.gnome.org/glade-2.0.dtd";>

<glade-interface>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title"
translatable="yes">window1</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property
name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property
name="destroy_with_parent">False</property>

  <child>
    <widget class="GtkVBox" id="vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child>
    <widget class="GtkButton" id="button1">
      <property name="visible">True</property>
      <property name="can_focus">True</property>
      <property name="label" translatable="yes">push
me</property>
      <property name="use_underline">True</property>
      <property
name="relief">GTK_RELIEF_NORMAL</property>
      <signal name="clicked"
handler="on_button1_clicked"
last_modification_time="Wed, 24 Mar 2004 20:24:12
GMT"/>
    </widget>
    <packing>
      <property name="padding">0</property>
      <property name="expand">False</property>
      <property name="fill">False</property>
    </packing>
      </child>

      <child>
    <placeholder/>
      </child>

      <child>
    <placeholder/>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

----- end simple.glade


--- Dan Korostelev <dan ats energo ru> wrote:
Hello.

I cross-compiled a libglade app from my Debian box
to Windows with
mingw32 package, but the in run-time, libglade can't
find signal
handlers defined in my program, connected in .glade
file.
How to cross-compile correctly??? Can you provide an
example of Makefile
or something?


==================================================================
Plese, don't send me any attachment in Micro$oft
(.DOC, .PPT) format.
Read

http://www.fsf.org/philosophy/no-word-attachments.html
Preferable attachments: .PDF, .HTML, .TXT
Please, consider adding this text to Your email
signature.




        
                
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]