comp.lang.ada
 help / color / mirror / Atom feed
* How can I loose the cmd window from my GtkAda app?
@ 2009-05-11 15:19 daniel.wengelin
  2009-05-11 15:53 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 10+ messages in thread
From: daniel.wengelin @ 2009-05-11 15:19 UTC (permalink / raw)




My GtkAda app opens a cmd window that I cannot get rid of. I tried to
search for a solution in the users guide and using google, but without
success. Any ideas?

I use GNAT GPL 2008 on Win XP.

/D



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 15:53 ` Dmitry A. Kazakov
@ 2009-05-11 15:30   ` Per Sandberg
  2009-05-11 16:40     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 10+ messages in thread
From: Per Sandberg @ 2009-05-11 15:30 UTC (permalink / raw)


Thar are two more ways:
* Add the following line to the source code of the main program:
      "pragma Linker_Options("-mwindows");
* If using gnat project files, Updated package linker add one of the 
folowing depending in taste:
   package Linker is
    ...
    ...
    for Switches("main.adb") use Linker'Default_Switches("Ada")
       & ("-mwindows");
   end Linker;

   package Linker is
    ...
    ...
    for Default_Switches("Ada") use Linker'Default_Switches("Ada")
       & ("-mwindows");
   end Linker;

   package Linker is
    ...
    ...
    for Default_Switches("Ada") use ("-mwindows");
   end Linker;
/Per


Dmitry A. Kazakov wrote:
> On Mon, 11 May 2009 08:19:16 -0700 (PDT), daniel.wengelin@home.se wrote:
> 
>> My GtkAda app opens a cmd window that I cannot get rid of. I tried to
>> search for a solution in the users guide and using google, but without
>> success. Any ideas?
> 
> You forgot to specify (-largs) -mwindows switch when linked your project
> for Windows. See, for example here:
> 
> http://www.cs.fsu.edu/~baker/ada/gnat/html/gnat_ugn_31.html
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 15:19 How can I loose the cmd window from my GtkAda app? daniel.wengelin
@ 2009-05-11 15:53 ` Dmitry A. Kazakov
  2009-05-11 15:30   ` Per Sandberg
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry A. Kazakov @ 2009-05-11 15:53 UTC (permalink / raw)


On Mon, 11 May 2009 08:19:16 -0700 (PDT), daniel.wengelin@home.se wrote:

> My GtkAda app opens a cmd window that I cannot get rid of. I tried to
> search for a solution in the users guide and using google, but without
> success. Any ideas?

You forgot to specify (-largs) -mwindows switch when linked your project
for Windows. See, for example here:

http://www.cs.fsu.edu/~baker/ada/gnat/html/gnat_ugn_31.html

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 15:30   ` Per Sandberg
@ 2009-05-11 16:40     ` Dmitry A. Kazakov
  2009-05-11 16:41       ` Per Sandberg
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dmitry A. Kazakov @ 2009-05-11 16:40 UTC (permalink / raw)


On Mon, 11 May 2009 17:30:12 +0200, Per Sandberg wrote:

> Thar are two more ways:
> * Add the following line to the source code of the main program:
>       "pragma Linker_Options("-mwindows");

Hmm, I don't like this, because it makes code platform-dependent.

> * If using gnat project files, Updated package linker add one of the 
> folowing depending in taste:
>    package Linker is

Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
I know no way to do this in a library project.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 16:40     ` Dmitry A. Kazakov
@ 2009-05-11 16:41       ` Per Sandberg
  2009-05-11 21:36       ` sjw
  2009-05-12  8:13       ` Jean-Pierre Rosen
  2 siblings, 0 replies; 10+ messages in thread
From: Per Sandberg @ 2009-05-11 16:41 UTC (permalink / raw)


Agree on that so thats why i suggested the gpr file solution, and that 
one could be expanded a bit more according to the following schema.

project proj is

    type OS_Type is ("Linux","Windows_NT");
    OS  : OS_Type := external ("OS","Linux");
    ...
    ...
    package Linker is
       case OS is
          when "Linux" =>
             for Default_Switches ("Ada") use
               ("-L/usr/local/lib/",
                "-lps2000");
          when "Windows_NT" =>
             for Default_Switches ("Ada") use
               ("-LC:\Program Files\Pico Technology\PicoScope6",
                "-lps2000",
                "-mwindows");
       end case;
    end Linker;
end proj;

/That how far i got in windows/Linux Interoperability
/Per


Dmitry A. Kazakov wrote:
> On Mon, 11 May 2009 17:30:12 +0200, Per Sandberg wrote:
> 
>> Thar are two more ways:
>> * Add the following line to the source code of the main program:
>>       "pragma Linker_Options("-mwindows");
> 
> Hmm, I don't like this, because it makes code platform-dependent.
> 
>> * If using gnat project files, Updated package linker add one of the 
>> folowing depending in taste:
>>    package Linker is
> 
> Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
> contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
> I know no way to do this in a library project.
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 16:40     ` Dmitry A. Kazakov
  2009-05-11 16:41       ` Per Sandberg
@ 2009-05-11 21:36       ` sjw
  2009-05-12  7:15         ` Dmitry A. Kazakov
  2009-05-12  8:13       ` Jean-Pierre Rosen
  2 siblings, 1 reply; 10+ messages in thread
From: sjw @ 2009-05-11 21:36 UTC (permalink / raw)


On May 11, 5:40 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:

> Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
> contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
> I know no way to do this in a library project.

I've provided strings in library projects ...

project Tash_Options is
   ......
   Library_Options :=
     (
      "-L/usr/lib",
      "-ltk8.4",
      "-ltcl8.4"
     );

    Linker_Options := ("-ltash") & Library_Options;
end Pash_Options;

with "tash_options";
project Tash is
   ...
   Linker_Options   := Tash_Options.Linker_Options;
   package Linker is
     for Default_Switches ("ada") use Linker_Options;
   end Linker;
   ...
end Tash;

after which you can get at the linker options with either

   Tash.Linker_Options

or

   Tash.Linker'Default_Switches ("ada")

(I don't remember why I supply both! must go to bed ..)



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 21:36       ` sjw
@ 2009-05-12  7:15         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry A. Kazakov @ 2009-05-12  7:15 UTC (permalink / raw)


On Mon, 11 May 2009 14:36:16 -0700 (PDT), sjw wrote:

> On May 11, 5:40�pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
> 
>> Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
>> contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
>> I know no way to do this in a library project.
> 
> I've provided strings in library projects ...
> 
> project Tash_Options is
>    ......
>    Library_Options :=
>      (
>       "-L/usr/lib",
>       "-ltk8.4",
>       "-ltcl8.4"
>      );
> 
>     Linker_Options := ("-ltash") & Library_Options;
> end Pash_Options;
> 
> with "tash_options";
> project Tash is
>    ...
>    Linker_Options   := Tash_Options.Linker_Options;
>    package Linker is
>      for Default_Switches ("ada") use Linker_Options;
>    end Linker;
>    ...
> end Tash;
> 
> after which you can get at the linker options with either
> 
>    Tash.Linker_Options
> 
> or
> 
>    Tash.Linker'Default_Switches ("ada")
> 
> (I don't remember why I supply both! must go to bed ..)

You can also rename Linker package:

   package Linker renames Parent_Project.Linker;

But in general I have a big question to the design of the GPR language. In
my view all packages of all parents projects should to be [multiple]
inherited by the child project, with an option to explicitly override them.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-11 16:40     ` Dmitry A. Kazakov
  2009-05-11 16:41       ` Per Sandberg
  2009-05-11 21:36       ` sjw
@ 2009-05-12  8:13       ` Jean-Pierre Rosen
  2009-05-12  9:24         ` Dmitry A. Kazakov
  2 siblings, 1 reply; 10+ messages in thread
From: Jean-Pierre Rosen @ 2009-05-12  8:13 UTC (permalink / raw)


Dmitry A. Kazakov a �crit :
> Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
> contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
> I know no way to do this in a library project.
> 
I don't think it would be a good idea, because sometimes you do want
that window (to get simple traces with Text_IO for example). And (AFAIK)
 there is no option to cancel a -mwindows option.

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-12  8:13       ` Jean-Pierre Rosen
@ 2009-05-12  9:24         ` Dmitry A. Kazakov
  2009-09-10 20:24           ` Jack Mitchell
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry A. Kazakov @ 2009-05-12  9:24 UTC (permalink / raw)


On Tue, 12 May 2009 10:13:04 +0200, Jean-Pierre Rosen wrote:

> Dmitry A. Kazakov a �crit :
>> Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
>> contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
>> I know no way to do this in a library project.
>> 
> I don't think it would be a good idea, because sometimes you do want
> that window (to get simple traces with Text_IO for example). And (AFAIK)
> there is no option to cancel a -mwindows option.

Using standard output is kind of "erroneous" in gtkada applications. Under
Windows it will most likely crash the application (due to Use_Error, I
guess).

For tracing I am using a GTK window, which is much simpler than text
tracing. It also allows to stop the application at the tracing point, catch
GTK/Glib errors with stack backtracing etc.

BTW, when running under GPS, output to the standard output works even with
-mwindows.

But the point was that -mwindows is just one example of what a library
project could like to pass to the clients.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How can I loose the cmd window from my GtkAda app?
  2009-05-12  9:24         ` Dmitry A. Kazakov
@ 2009-09-10 20:24           ` Jack Mitchell
  0 siblings, 0 replies; 10+ messages in thread
From: Jack Mitchell @ 2009-09-10 20:24 UTC (permalink / raw)


As something of a newby, I added the -nwindows option only on the 
production builds (I have a debug package which writes to file and to 
the console if stdout is open)

E.G.

    package Linker is
       ...........
       case Mode is
          when "Debug" =>

          when "Production" =>
             for Default_Switches ("ada") use Linker'Default_Switches 
("-mwindows");
       end case;
    end Linker;





In message <w9hl8hae9g57$.ry62m3ommmaw.dlg@40tude.net>, Dmitry A. 
Kazakov <mailbox@dmitry-kazakov.de> writes
>On Tue, 12 May 2009 10:13:04 +0200, Jean-Pierre Rosen wrote:
>
>> Dmitry A. Kazakov a �crit :
>>> Yes, however I would prefer to have it enforced by gtkada.gpr, rather than
>>> contaminating the application's gpr which with-es gtkada.gpr. Unfortunately
>>> I know no way to do this in a library project.
>>>
>> I don't think it would be a good idea, because sometimes you do want
>> that window (to get simple traces with Text_IO for example). And (AFAIK)
>> there is no option to cancel a -mwindows option.
>
>Using standard output is kind of "erroneous" in gtkada applications. Under
>Windows it will most likely crash the application (due to Use_Error, I
>guess).
>
>For tracing I am using a GTK window, which is much simpler than text
>tracing. It also allows to stop the application at the tracing point, catch
>GTK/Glib errors with stack backtracing etc.
>
>BTW, when running under GPS, output to the standard output works even with
>-mwindows.
>
>But the point was that -mwindows is just one example of what a library
>project could like to pass to the clients.
>

-- 
Jack Mitchell



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-09-10 20:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11 15:19 How can I loose the cmd window from my GtkAda app? daniel.wengelin
2009-05-11 15:53 ` Dmitry A. Kazakov
2009-05-11 15:30   ` Per Sandberg
2009-05-11 16:40     ` Dmitry A. Kazakov
2009-05-11 16:41       ` Per Sandberg
2009-05-11 21:36       ` sjw
2009-05-12  7:15         ` Dmitry A. Kazakov
2009-05-12  8:13       ` Jean-Pierre Rosen
2009-05-12  9:24         ` Dmitry A. Kazakov
2009-09-10 20:24           ` Jack Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox