Overview:
The conversion of the Exploratory Project (EP)
from Windows to Linux has been completed.
That is, as far as its framework is concerned and
communications between User Applications via named pipes (as the replacement
for Microsoft MS Pipes). The Display
Application that is the A661 protocol application that is the graphical user
interface (GUI) has yet to be done.
This will be a bigger conversion since the Windows version written in
Visual C# cannot be used while just applying Linux interface procedures to
replace those to Windows via Win32Ada – so an entirely new application will
need to be written.
There are three user applications that communicate
with each other. Each uses the EP
framework that manages the registration of worker components and the delivery
of instances of topic message instances from the topic producer component to
the consumer component. The consumer
component can be in the same user application (Linux process) as the producer
or in one of the other two user applications.
It makes no difference since a remote registration phase of the system
startup finds the remote applications that have components that consume (or
produce) the topic. The framework will
delivery the topic within the local application or remotely or both. The number of possible consumers (and
publishers) depends upon the topic method of Message Exchange.
See earlier (pre-Linux) posts for more information
about the framework and the user applications.
Besides the Display application, another feature
of the Windows version that remains unimplemented is the ability to use the
TCP/IP protocol for inter-application communications. The Windows version uses WinSock(ets) whereas, like MS Pipes, a
Linux interface will need to be used instead.
Design:
One design change was to eliminate the use of
Microsoft Mailslots to determine which of the possible remote applications
identified in the configuration file are actually running and so can be
communicated with.
The use of mailslots was no longer necessary after
I discovered the Win32 interface to provide the running processes but it was
never removed. Now for the Linux
version with its version of my Is_Running executive interface function (see a
previous post) it has been.
The Linux implementation uses a revised version of
the Ada mc-exec package to act as an interface to the executive / operating
system. It also replaces the use of the
Win32Ada package to provide an interface with the Windows operating system with
the use of a new exec_itf package.
These have been described in previous posts.
The framework and the worker component code
remains unchanged except where a reference to a Win32Ada procedure/function had
to be replaced to a reference to the new exec_itf. This flaw in the Windows version can be fixed by the use of a
Windows version of exec_itf to be the direct interface to the Win32Ada
procedures – that is, the use of another interface layer so that the framework
code can be free of operating system dependencies.
Implementation:
The third user application (app3) has a
combination of Ada, C, and C++ components.
Therefore, the GNAT builds that I had been using had to be revised since
just building the GNAT project via gnatmake wasn't working (as it had not been
working in Windows using GNAT GPS).
Even thou the use of C and C++ in addition to Ada were specified in the
project, both GPS and the Linux gnatmake that referenced the project failed to
cause the C and C++ files to be compiled and linked.
Therefore, I used a build file (xyapp3) in my bin
folder to do the build for app3. This
file is as follows.
#
# add particular ada files to the library that are
referenced by C or C++
cd /home/clayton/Source/EP/Object3
rm libapp3.a
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Util
/home/clayton/Source/EP/Ada/A661UA/App3/com_periodic.adb -o com_periodic.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Util
/home/clayton/Source/EP/Ada/A661UA/mt-topic_periodic.adb -o mt-topic_periodic.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Util
/home/clayton/Source/EP/Ada/A661UA/mt-topic_n_to_one_1.adb -o
mt-topic_n_to_one_1.o
ar rc libapp3.a com_periodic.o mt-topic_periodic.o
mt-topic_n_to_one_1.o
#
# do the gnatmake
cd /home/clayton/Source/EP/Ada/A661UA
gnatmake -c -Papp3.gpr
#
# do xyapp3c to compile C and C++, add to the library,
and do the bind and link
xyapp3c
where
xyapp3c is
# change directory/folder to Object3
cd /home/clayton/Source/EP/Object3
pwd
# g++ -c -g
-I/home/clayton/Source/EP/Ada/A661UA -I/home/clayton/Source/EP/Util
/home/clayton/Source/EP/Util/console.adb -o
/home/clayton/Source/EP/Object3/console.o
# g++ -c -g
-I/home/clayton/Source/EP/Ada/A661UA -I/home/clayton/Source/EP/Util /home/clayton/Source/EP/Ada/A661UA/App3/com_periodic.adb
-o /home/clayton/Source/EP/Object3/com_periodic.o
# rm /home/clayton/Source/EP/Object3/libapp3.a
# ar rc
/home/clayton/Source/EP/Object3/libapp3.a
/home/clayton/Source/EP/Object3/com_periodic.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
/home/clayton/Source/EP/Ada/A661UA/App3/app_initializeada.c -o
/home/clayton/Source/EP/Object3/app_initializeada.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
/home/clayton/Source/EP/Ada/A661UA/mt-topic.c -o /home/clayton/Source/EP/Object3/mt-topic.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
/home/clayton/Source/EP/Ada/A661UA/mt-topicnto1.c -o
/home/clayton/Source/EP/Object3/mt-topicnto1.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
/home/clayton/Source/EP/Ada/A661UA/mt-topic1ofn.c -o
/home/clayton/Source/EP/Object3/mt-topic1ofn.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/mt-topicperiodic.c -o
/home/clayton/Source/EP/Object3/mt-topicperiodic.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
/home/clayton/Source/EP/Ada/A661UA/mt-topiccontentfiltered.c -o
/home/clayton/Source/EP/Object3/mt-topiccontentfiltered.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/comc1.c -o
/home/clayton/Source/EP/Object3/comc1.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/comc2.c -o /home/clayton/Source/EP/Object3/comc2.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/component.cpp -o
/home/clayton/Source/EP/Object3/component.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/app_initializec.c -o
/home/clayton/Source/EP/Object3/app_initializec.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/appc++.cpp -o
/home/clayton/Source/EP/Object3/appc++.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/app_initializecpp.c -o /home/clayton/Source/EP/Object3/app_initializecpp.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/com3c.cpp -o
/home/clayton/Source/EP/Object3/com3c.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/mt_topic.cpp -o
/home/clayton/Source/EP/Object3/mt_topic.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3 /home/clayton/Source/EP/Ada/A661UA/mt_topic_n_to_one_1.cpp
-o /home/clayton/Source/EP/Object3/mt_topic_n_to_one_1.o
g++ -c -g -I/home/clayton/Source/EP/Ada/A661UA
-I/home/clayton/Source/EP/Ada/A661UA/App3
/home/clayton/Source/EP/Ada/A661UA/App3/mt_topic_periodic.cpp -o
/home/clayton/Source/EP/Object3/mt_topic_periodic.o
cd /home/clayton/Source/EP/Object3
ar rc libapp3.a com3c.o
ar rc libapp3.a appc++.o app_initializec.o
app_initializecpp.o app_initializeada.o
ar rc libapp3.a mt-topic.o mt-topicnto1.o
mt-topic1ofn.o mt-topicperiodic.o mt-topiccontentfiltered.o mt_topic.o
mt_topic_n_to_one_1.o mt_topic_periodic.o
ar rc libapp3.a comc1.o comc2.o component.o
#
gnatbind -x app3.ali
gnatlink app3.ali libapp3.a --LINK=c++ -o
app3.exe
The use of the libapp3.a library means that the large number
of .o object files for the C and C++ code do not need to be included in the
gnatlink line.
The use of the --LINK=c++ parameter
in the gnatlink command avoids a __gxx_personality_v0 problem that otherwise
occurs with the mixture of Ada and C++.
When I searched the internet about the gxx_personality error
after I got it there were a number of Linux commentators giving their take on a
fix – such as creating a particular dummy routine to satisfy the linker and
avoid getting the error. However, GNAT
itself said to use
--LINK=c++ and that fixed the gxx_personality error without
the suggested hijinks of the Linux fixers.
No comments:
Post a Comment