[PB-Linux] Using GLADE as VD for pureBasic (0.3.0)

Developed or developing a new product in PureBasic? Tell the world about it.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi,

I'll do... that was the reason why I'd started glade2pb :wink:
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Extremelly usefull! Thanks walker! * Thumbs up *
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Thank you..

So I might started it at the right time... as you'd switched completely to Linux (read it in another post 8) ....good decision)
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Thanks! BTW, I'm having a big problem... Can't find any docs for GLADE and the package I got with urpmi doesn't have the docs in it... Do you know some sites where I can learn to use it? I can't move widgets :((.

PS. Running on Mandriva2006 and your app exits whenever I push any button. What should I do?
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Well the exact same problem exists on dapper too as mentioned above I will download his package now and begin investigation...

EDIT:
Ok I think it is a serious problem, however I had luck and could find some things out.
I startet the PB code with the Debugger, all works well until one clicks a button, then the Debugger show a Memory access violation at the end of the procedure. I know nothing about gtk and have never used it howeverr I suspected that the callbacks are called by the signal handlers

Code: Select all

 g_signal_connect_object_( *toolbutton1, "clicked",@on_toolbutton1_clicked(),#Null, #Null);
so I removed all of the signal connects and ran again now I couldn crahsh it, so I enabled the first one and added a few simple commands to it and a CallDebugger in the beginning. This showed that the commands are run, and it crashes only at the ProcedureReturn. Though I know very little ASM I suspected that ProcedureReturn uses the assembler "ret" menemonic so I added !ret between the commands and this lead to:

Code: Select all

Procedure on_toolbutton1_clicked (toolbutton,user_data)
;Your code here
CallDebugger
a.l=10
b.l=20
Debug a+b
Debug b-a

!inc eax
debug a*b
!ret

c.l=10
d.l=20
Debug c+d
EndProcedure
Again stepping through this part of the code showed that it is now crashing at the !ret instruction. This leads to the conclusion that the problem is that the processor doesn't know where to jump when a ret happens. As I said I know nothing about asm, but I suspect that it has to do with how the procedure is called, as far as I know this is called the calling convention and it seems that different GTK versions use different calling conventions. And that PB is using a different one. I will now try to declare the callback as ProcedureC and report wether this solves the problem...
I hope this news may help you walker or maybe even Fred, since he might run into the same problem.
Last edited by Nik on Tue May 23, 2006 9:06 pm, edited 1 time in total.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Great! I hope you find the problem...

BTW, I ran it from the console and got this error: "Segmentation error!". Hope it helps.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Well ok I found a working, however ugly solution, declaring the Procedure with ProcedureCDLL solves the crashing. On the other hand the Debugger crashes when he encounters such a procedure.
An updated version of the example can be found here
sceneproject.org/~niklas/PBTests/CDLLTest.tar.gz

Sourcecode and excutable is includede
@Infobyte: Please test wether it fixes Mandriva as well
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Yep, tested it and it works perfectly. Here's a screenshot :

Image
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Hehe, realy realy nice to see.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

I hope walker will fix this soon :D...We really need a VD. It would spare us hours of work.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi,

could you please download g2pb again? I'd tried (after studying the gtk2 reference a while) to solve the problem... please start the prog from a command line and report the output (if any)... I'd changed the G_Signal_Connect_Object() call a bit... (may i'd missunderstood it in the past...)

The downloadlink: http://home.arcor.de/x-linux/pure/g2pb

Thanks in advance

PS: It was Nik's report which brought me to the idea
Last edited by walker on Tue May 23, 2006 10:23 pm, edited 1 time in total.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Unlike the ProcedureCDLL trick it doesn't fix the problem the error still is "Speicherzugriffsfehler" aka "Memory Access Violation"
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hmmmmm... I belive it's a limmitation of PB3.94...
I get NO error running it on my Kanotix-Box (full updated; debian based)

My opinion:
When Fred started the development, he uses a GTK/GLib etc Version of 2.4 or 2.6 I think... These libs are included in PB...(statically) That's why PB 3.94 runs on older Distros without any issue (even the GTK2-Ide works perfect)

But who uses a distro from around the beginning of 2005 without updates? (Nobody... except maybe Fred :wink: )
That is an issue to be solved in the future... the installed version should be used dynamically...(the GTK-development is now at V2.9)

Anyway.. I don't give up... there is a solution.. somewhere.. I still have to find it :roll:
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Just read two or three posts above and see my solution^^ :roll:
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi,

I'd raed it.. and I'm changing the Source at the moment... thanks.. but here is a screenshot of the example when I'm running it... please compare it to the one of Inf0Byt3...
the 3 Buttons are the difference (no Icons).. Why?? I don't know.. I think, that's an issue of the different gtk versions (see above) and such things should not happen!
If this issue is not solved in PB4.0, you'll never be able to give away an application which uses GTK-stuff... you'll never be sure about if it's working or not... :(

My screenshot:
Image
Post Reply