comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: texttools and standard library packages
Date: Thu, 12 Dec 2013 19:44:58 +0200
Date: 2013-12-12T19:44:58+02:00	[thread overview]
Message-ID: <bgub0qFd0c5U1@mid.individual.net> (raw)
In-Reply-To: <r1bja99f6ddpu0i6d3f3e6fmq0du86evj9@4ax.com>

On 13-12-12 14:34 , agent@drrob1.com wrote:
> So I decided to use uio_ and uio2_ programs.  These
> compiled.  But generated lots of linker unresolved symbol errors.  The
> commandline I used was:
> 
> gnatmake -g -gnatf -gnato -fstack-check -gnatVa -gnatwu -gnat2012 -lm
> -lncurses

If you want to specify more (non-Ada) libraries to be linked into your
Ada program, you should either use the pragma Linker_Options in the Ada
source files or put the linker options in the gnatmake command _after_
the gnatmake option -largs. At least, as I understand it.

Here is what I did, just to see how I could make it work (I don't use
texttools in my own programs). I'm on a Mac (Darwin Kernel Version
12.5.0). The texttools kit comes with some Makefiles and GNAT project
files, but I am used to doing things with less automated methods; others
on c.l.a can perhaps help you use the Makefiles and project files.

1. I went to the examples folder and compiled the C modules as follows:

   gcc -c -g -O2 ../src/curses.c
   gcc -c -g -O2 ../src/system.c

To make the compilation succeed, I had to edit system.c to change the
line #include <wait.h> to #include <sys/wait.h>.

The result of this compilation is curses.o and system.o in the examples
folder.

2. I built the "basic" example using this gnatmake command:

   gnatmake -g -O2 basic.adb -largs system.o curses.o -lncurses

This compiles the necessary Ada modules, "binds" the Ada program, and
then links the Ada and C modules. The last two lines from the gnatmake
command show what happens (these lines are generated by gnatmake, not
commands that I entered myself):

   gnatbind -x basic.ali
   gnatlink basic.ali -g system.o curses.o -lncurses

The result is a slew of .ali and .o files, and the executable "basic".

3. I test the "basic" demo with the command

  ./basic

This changes the terminal window to white-on-black, fills most of the
window with some strange symbol (I don't know if that is intentional),
draws a white-on-blue box labelled "Basic Window" in the upper left
corner of the screen, which shows some text, and then terminates when I
press some key on the keyboard, as the demo seems intended to do. The
terminal window is restored to my default settings (black-on-white,
etc.) So this "basic" demo seems to work.

However, if I do the same with the uio2_demo, the terminal changes to
white-on-black as above, but then a NAME_ERROR exception happens in the
demo, which terminates without restoring the terminal window to
black-on-white. I haven't debugged this further; it may be a problem
just in this demo.

(In my copy of texttools, the uio_demo has all its statements commented
out, and is just a null procedure. Some demo...)

I hope this helps you get further.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .



  reply	other threads:[~2013-12-12 17:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  2:25 texttools and standard library packages agent
2013-12-11 12:48 ` Niklas Holsti
2013-12-12 12:34   ` agent
2013-12-12 17:44     ` Niklas Holsti [this message]
2013-12-12 18:00       ` Dmitry A. Kazakov
2013-12-16  0:43         ` agent
2013-12-16  1:11           ` Ludovic Brenta
2013-12-16  1:38             ` agent
2013-12-16  8:18           ` Dmitry A. Kazakov
2013-12-16  9:23             ` Simon Wright
2013-12-19  1:40               ` agent
2013-12-19  8:57                 ` Simon Wright
2013-12-19 12:59                   ` agent
2013-12-20  1:46                     ` agent
2013-12-15 22:05 ` koburtch
2013-12-22 19:24   ` koburtch
2013-12-27  0:35     ` agent
2014-01-03 21:38       ` Ludovic Brenta
2014-01-05 21:33         ` agent
2013-12-27  0:36     ` agent
replies disabled

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