Re: Re[2]: argv

2016-04-16 Thread Errol van de l'Isle
> _pascal was used for older 16-bit Windows programs.
> _stdcall is used for newer 32-bit Windows programs.
> _cdecl is the defacto standard for all main() functions *declared* in
> C.
> 
> All three conventions use the same stack parameter order of right-to-
> left.

Pascal uses left to right.

“It’s wingardium leviOsa, not leviosAH.”
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Re[2]: argv

2016-04-16 Thread Errol van de l'Isle
> 1) The initial handling of argc and argv are not done by your
> application but
> by the linker.
Incorrect. The linker has nothing to do with argc and argv.

> 2) In C, argc and argv are on the stack, ready to be used, but not
> necessarily
> in assemblers
Yes and no :) It depends on what the start-up routine if any does
before calling main.

Are you linking in the C run-time start up. Under gcc this is crt0.o
and it is this which sets up the arguments for main() and other book
keeping before calling it.

In fact main() is not the starting point for any application and that
includes C.

There is no need for argc and argv to use gtk_init(). You can just pass
null pointers.

> You obviously know absolutely nothing about system assembly language
> programming, yet you are offering advice to people about it as if you
> were an
> expert? You shouldn't even be in this forum offering advice on things
> you know
> nothing about, so I am not responding to you anymore. You can BS some
> of the
> people some of the time, but you can't BS all the people all the
> time.
Now that is not nice. :( Yes I do know assembly language (several of
them) but it is not my first choice of language for doing any
programming unless it is very low level which the high level language
can not do such as switching privileges or very tight loops that need
to be very fast but even that may have minimal to zero gain over a high
level language. Those parts will only be a tiny part of an application.

Your problem has nothing to do with GTK or any other graphical tool
kit. It is all about how the application is started. Without knowing
how you are linking your application and with what, all we can do is
guess (or try to mind read) what you are doing.

If you can provide information on how you are linking your objects and
in what order then I may be able to spot where the error is. The best
would be the full linker command.

Got grade F in mind reading skills at Hogwarts.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Re[2]: Re[2]: argv

2016-04-16 Thread Errol van de l'Isle

> Yes, I have a test program and it is the one I am debugging, and no,
> it won't
Is this test program in C and uses GTK so that you can confirm that you
are not getting any command line sent to the application. This way you
could narrow down where the error is. If the C test program gets the
arguments then it is your code. If it does not then you need to look
else where.

There are other possibilities to look for which are Microsoft specific.
Which can prevent arguments being passed. https://msdn.microsoft.com/en
-us/library/zay8tzh6.aspx could be an issue. There can be different C
run time start up code so make sure that you have one and the right
one.

You can get the command line using the Microsoft API https://msdn.micro
soft.com/en-us/library/windows/desktop/ms683156%28v=vs.85%29.aspx and h
ttps://msdn.microsoft.com/en-
us/library/windows/desktop/bb776391%28v=vs.85%29.aspx which is what the
C runtime will call anyway.

> one of the (hidden) reasons I came here. Is this just a problem with
 Don't hide information

I'm a lumberjack, and I'm okay,
I sleep all night and I work all day.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Re[2]: argv

2016-04-16 Thread Errol van de l'Isle
> 1) It uses the 64-bit Linux libraries whereas I am using the 32-bit
> Win
Should not really matter

> 2) GCC assembly language sucks :^)
It uses AT syntax which many think is not nice to read.

> 3) Despite #2 above, I noticed something very peculiar about the
> disassembly
> code. For argv, GCC uses a 32-bit register, whereas for the argc, GCC
> uses a
> 64-bit register. This isn't documented anywhere. Does this apply to
> 32-bit Win
> code as well, i.e. -- argv would use a 32-bit register and argc would
> use a
> 16-bit register? This disassembly example violates the 64-bit code
> convention
> used by the C standard and by the Win and Linux OSes as well.
You might have come across the nightmare of which calling convention to
use. Things vary between OS and compiler! This document might be of
interest http://agner.org/optimize/calling_conventions.pdf  .

> 4) The documentation implies argc and argv are consecutive
This is the C convention.

> 5) It uses the Gtk+2 libraries whereas I am using Gtk+3. It appears
> that the
> Gtk+2 libraries pass parameters in the registers and there is no
> stack
> cleanup, whereas the Gtk+3 libraries pass parameters on the stack and
> stack
> cleanup is required. Again, not documented. This may not matter
> unless I
> wanted to convert my application later on to 64-bit, so this is good
> to know
> beforehand.
See 3. This is again the problem of calling convention.

The majority of people will use GTK from a high level language so
questions on assembly would not be second nature.

When replying to the mailing list only reply to the list and do not
include the personal e-mail address of others in the mailing list. They
will get two copies of your message and will probably (and possible
have) get a little bit fed up to put it nicely.

Your original posting was fairly terse which lead to others assuming
that you did not know much on the subject. To many it looks like you
had only got to the parsing the augments stage and no further :-/ . If
the others on the list are still reading, play nicely now there is no
need to start a flame war. :o)

Back to your original problem :-) You may have done this already. Have
you tried making a test application using the libraries you are using
in C, C++ or D. You will need to make sure that you are using the same
memory model etc. as your assembly. All this needs to do is get the
command line arguments, print them to the terminal (or where ever you
want) and then display a dialog window where you click on a button to
exit. This would make sure that you have GTK compiled in, test that you
can get the arguments and see what code is actually generated for the
GUI application.

Always look on the bright side of life
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list