comp.lang.ada
 help / color / mirror / Atom feed
* Porting Ada code to Linux
@ 2006-10-31 14:17 Bill
  2006-10-31 14:30 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Bill @ 2006-10-31 14:17 UTC (permalink / raw)


We have some code (about 60K lines) that was written for use on the
Win95 platform as a collection of DLLs.  We are now in the process of
porting the parent application to Linux and would like to reuse the Ada
code.  The legacy code was written using the Aonix ObjectAda
compiler/IDE and references packages like Win32 and Win32.Windef.

We have been able to move the code over to the Linux side and compile
using the GNU Ada compiler.  However, to get this far we also had to
copy the aforementioned "Win" packages over too.  Clearly, this seems
like the wrong thing to do, but it did get the compile to work.  The
problem is that we are receiving a fair number of linker errors that
seem to point to the file winbase.h.

So, it seems like there should be a Linux equivalent of Win32, but we
have not been able find it.  Can anyone point us to a replacement for
these packages that will make the compiler AND the linker happy?  Is
there anything else we should know about in our effort to complete this
port?

Thanks in advance.
Bill Lugg




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

* Re: Porting Ada code to Linux
  2006-10-31 14:17 Porting Ada code to Linux Bill
@ 2006-10-31 14:30 ` Georg Bauhaus
  2006-10-31 17:38 ` Howard
  2006-11-01 10:14 ` Alex Buell
  2 siblings, 0 replies; 13+ messages in thread
From: Georg Bauhaus @ 2006-10-31 14:30 UTC (permalink / raw)


On Tue, 2006-10-31 at 06:17 -0800, Bill wrote:

> So, it seems like there should be a Linux equivalent of Win32, but we
> have not been able find it.  Can anyone point us to a replacement for
> these packages that will make the compiler AND the linker happy?  Is
> there anything else we should know about in our effort to complete this
> port?

The Win32 library is Windows specific, a different operating
system is going to use different system calls. However, in order
to get things started, you could try the Wine libraries.
They can be found here:
http://www.winehq.com/





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

* Re: Porting Ada code to Linux
  2006-10-31 14:17 Porting Ada code to Linux Bill
  2006-10-31 14:30 ` Georg Bauhaus
@ 2006-10-31 17:38 ` Howard
  2006-10-31 18:16   ` Martin Krischik
                     ` (6 more replies)
  2006-11-01 10:14 ` Alex Buell
  2 siblings, 7 replies; 13+ messages in thread
From: Howard @ 2006-10-31 17:38 UTC (permalink / raw)


I work with Bill, and I wanted to provide a more detailed expansion of
our situation;

We are porting from a Windows-95 "legacy" system to a new Linux one.
The code we are re-writing is Visual Basic, and we are translating it
into C++.  But, the VB code had a dependancy on a considerable amount
of Ada 95 code that the VB code interfaced with via DLLs.

We need to port this Ada code over, also.  We have decided, given that
there is between 45 and 55 thousand lines of Ada code, with its
attendant complexity, to simply use the Ada code as is without
re-writing it into C++.  This Ada code depends on some files, also
written in Ada, that then have some pragmas to a Visual C++ library,
"winbase.h"...

The Ada libs are;

Win32
Win32-Utils
Win32-Winbase (pragmas to VCPP winbase.h lib)
Win32-Windef
Win32-Winnt

Stdarg
Stdarg-Impl
Stdarg-Inst
Stdarg-Machine

These are all Ada packages, and these name represent specs, and bodies,
so named.

So, we are going to have to compile the Ada code, then link it with the
new C++ code.  We are using the Gnu-G++ compiler linker, and we will
need to be able to link in the Ada object files with our C++ files.  We
have to find a way to replace, or port, the mentioned Ada libs.

The "Winbase" dependancy on the Visual C++ files is problematic, at
best...

So, again, any insight that can be provided would be greatly
appreciated.  You can write me directly at 

Howard.Parrish@cisf.af.mil




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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
@ 2006-10-31 18:16   ` Martin Krischik
  2006-10-31 20:29     ` Gautier
  2006-10-31 20:21   ` Dr. Adrian Wrigley
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Martin Krischik @ 2006-10-31 18:16 UTC (permalink / raw)


Howard wrote:

> The Ada libs are;
> 
> Win32
> Win32-Utils
> Win32-Winbase (pragmas to VCPP winbase.h lib)
> Win32-Windef
> Win32-Winnt
> 
> Stdarg
> Stdarg-Impl
> Stdarg-Inst
> Stdarg-Machine

They are not Ada libraries but Ada bindings. And the real problem you are
going to have is to find a replacement for the Libraries those binding are
binding to.

i.E. For Win32* you will need a Linux replacement for "win32.dll".

I like to point out that you would have the same problem if the code was
written in C (so it would be unfair to say "damm you Ada") in which case
you would look for a replacement of "windows.h" and it's friend. It's low
level operating system access and it just isn't there in Linux.

The bad news is: You need to replace it all with low level Linux access.

Martin
-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
  2006-10-31 18:16   ` Martin Krischik
@ 2006-10-31 20:21   ` Dr. Adrian Wrigley
  2006-10-31 20:26   ` Michael Bode
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Dr. Adrian Wrigley @ 2006-10-31 20:21 UTC (permalink / raw)


On Tue, 31 Oct 2006 09:38:14 -0800, Howard wrote:

> I work with Bill, and I wanted to provide a more detailed expansion of
> our situation;
> 
> We are porting from a Windows-95 "legacy" system to a new Linux one.
> The code we are re-writing is Visual Basic, and we are translating it
> into C++.  But, the VB code had a dependancy on a considerable amount
> of Ada 95 code that the VB code interfaced with via DLLs.
> 
> We need to port this Ada code over, also.  We have decided, given that
> there is between 45 and 55 thousand lines of Ada code, with its
> attendant complexity, to simply use the Ada code as is without
> re-writing it into C++.  This Ada code depends on some files, also
> written in Ada, that then have some pragmas to a Visual C++ library,
> "winbase.h"...

Rather than trying to convert the VB into C++, keep the Ada,
convert the Ada into Linux and glue the C++ to the Ada,
why don't you convert the VB into Ada?

You don't seem to have a strong technical reason to combine
C++ and Ada, since C++ isn't a current implementation language.
Because C++ and Ada have similar capabilities ("modern" compiled OO
languages), the technical advantages of mixing them in new
code are minimal.  Mixing languages always has a cost - staff
training, reduced compiler support, tricky interfaces, whatever.

Since you plan to convert to C++, you must have good reasons.
Political?  Skills sets?  Anyone well skilled in both C++ and Ada
would keep it all in the same language (Ada), or have a really
good justification already for mixing (interfacing to existing,
complex C++ libraries without Ada bindings, perhaps).
But since you haven't chosen the Linux libraries yet, this
can't be why.

I suspect you want to move to C++ for a mixture of political
and skills reasons, but this really warrants planning to
rewrite *all* the Ada, in due course.  History suggests this
is an unsound approach when existing code works broadly as needed.
If politics is absent, do it all in Ada, getting necessary
skills from outside.

Just my thoughts.
--
Adrian

PS: If you email me the VB, Ada code, I'll rewrite it in Ada/Linux...
for a small fee.




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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
  2006-10-31 18:16   ` Martin Krischik
  2006-10-31 20:21   ` Dr. Adrian Wrigley
@ 2006-10-31 20:26   ` Michael Bode
  2006-10-31 20:40   ` Gautier
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Michael Bode @ 2006-10-31 20:26 UTC (permalink / raw)


"Howard" <Howard.Parrish@peterson.af.mil> writes:

> Win32
> Win32-Utils
> Win32-Winbase (pragmas to VCPP winbase.h lib)
> Win32-Windef
> Win32-Winnt
>
> Stdarg
> Stdarg-Impl
> Stdarg-Inst
> Stdarg-Machine
>
> These are all Ada packages, and these name represent specs, and bodies,
> so named.
>
> So, we are going to have to compile the Ada code, then link it with the
> new C++ code.  We are using the Gnu-G++ compiler linker, and we will
> need to be able to link in the Ada object files with our C++ files.  We
> have to find a way to replace, or port, the mentioned Ada libs.
>
> The "Winbase" dependancy on the Visual C++ files is problematic, at
> best...
>
> So, again, any insight that can be provided would be greatly
> appreciated.  You can write me directly at 
>
> Howard.Parrish@cisf.af.mil
>

-- 
Michael Bode



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

* Re: Porting Ada code to Linux
  2006-10-31 18:16   ` Martin Krischik
@ 2006-10-31 20:29     ` Gautier
  0 siblings, 0 replies; 13+ messages in thread
From: Gautier @ 2006-10-31 20:29 UTC (permalink / raw)


Martin:

> They are not Ada libraries but Ada bindings. And the real problem you are
> going to have is to find a replacement for the Libraries those binding are
> binding to.
> 
> i.E. For Win32* you will need a Linux replacement for "win32.dll".
> 
> I like to point out that you would have the same problem if the code was
> written in C (so it would be unfair to say "damm you Ada") in which case
> you would look for a replacement of "windows.h" and it's friend. It's low
> level operating system access and it just isn't there in Linux.
> 
> The bad news is: You need to replace it all with low level Linux access.

And also to be mentioned, the good news are: most of the code (the parts not 
bound to Win32) will be very easy to port, and that is because it is in Ada...
______________________________________________________________
Gautier         -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
                     ` (2 preceding siblings ...)
  2006-10-31 20:26   ` Michael Bode
@ 2006-10-31 20:40   ` Gautier
  2006-10-31 23:10     ` Dr. Adrian Wrigley
  2006-10-31 20:41   ` Michael Bode
                     ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Gautier @ 2006-10-31 20:40 UTC (permalink / raw)


Howard:

> We are porting from a Windows-95 "legacy" system to a new Linux one.
> The code we are re-writing is Visual Basic, and we are translating it
> into C++.  But, the VB code had a dependancy on a considerable amount
> of Ada 95 code that the VB code interfaced with via DLLs.

Since VB is syntactically strongly inspired by Ada, it will make more sense to 
translate your VB code into Ada. In addition, linking the translated code to 
the existing Ada code will be *way* easier (just through "with", "use") than 
trying to do that from a C++ code...
HTH, Gautier
______________________________________________________________
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
                     ` (3 preceding siblings ...)
  2006-10-31 20:40   ` Gautier
@ 2006-10-31 20:41   ` Michael Bode
  2006-11-01  3:28   ` Steve
  2006-11-01  9:03   ` Dmitry A. Kazakov
  6 siblings, 0 replies; 13+ messages in thread
From: Michael Bode @ 2006-10-31 20:41 UTC (permalink / raw)


"Howard" <Howard.Parrish@peterson.af.mil> writes:

> The Ada libs are;
>
> Win32
> Win32-Utils
> Win32-Winbase (pragmas to VCPP winbase.h lib)
> Win32-Windef
> Win32-Winnt
>
> Stdarg
> Stdarg-Impl
> Stdarg-Inst
> Stdarg-Machine
>
> These are all Ada packages, and these name represent specs, and bodies,
> so named.
>
> So, we are going to have to compile the Ada code, then link it with the
> new C++ code.  We are using the Gnu-G++ compiler linker, and we will
> need to be able to link in the Ada object files with our C++ files.  We
> have to find a way to replace, or port, the mentioned Ada libs.
>
> The "Winbase" dependancy on the Visual C++ files is problematic, at
> best...

The Win32... things are bindings to the Windows API. You need to find
out what Windows functions your app needs and then find equivalent
Linux (or POSIX) APIs (Florist is an Ada binding to POSIX). These will
probably not be 1:1 equivalences (creating a file in Win32 is
different from creating a file in POSIX).  

The Win32 functions could e.g. be GUI functions (create a window,
handle windows message, draw a line, create a dialog box). Then you
have to decide if you want to implement that functionality using raw
X11 or some GUI toolbox like GTK+ (GtkAda is an Ada binding to
GTK+). Or it could be registry access functions. There is no registry
in Linux.

-- 
Michael Bode



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

* Re: Porting Ada code to Linux
  2006-10-31 20:40   ` Gautier
@ 2006-10-31 23:10     ` Dr. Adrian Wrigley
  0 siblings, 0 replies; 13+ messages in thread
From: Dr. Adrian Wrigley @ 2006-10-31 23:10 UTC (permalink / raw)


On Tue, 31 Oct 2006 21:40:39 +0100, Gautier wrote:

> Howard:
> 
>> We are porting from a Windows-95 "legacy" system to a new Linux one.
>> The code we are re-writing is Visual Basic, and we are translating it
>> into C++.  But, the VB code had a dependancy on a considerable amount
>> of Ada 95 code that the VB code interfaced with via DLLs.
> 
> Since VB is syntactically strongly inspired by Ada, it will make more sense to 
> translate your VB code into Ada. In addition, linking the translated code to 
> the existing Ada code will be *way* easier (just through "with", "use") than 
> trying to do that from a C++ code...

Two votes for this plan! (see my other post...)
--
Adrian




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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
                     ` (4 preceding siblings ...)
  2006-10-31 20:41   ` Michael Bode
@ 2006-11-01  3:28   ` Steve
  2006-11-01  9:03   ` Dmitry A. Kazakov
  6 siblings, 0 replies; 13+ messages in thread
From: Steve @ 2006-11-01  3:28 UTC (permalink / raw)


"Howard" <Howard.Parrish@peterson.af.mil> wrote in message 
news:1162316294.922457.113520@h48g2000cwc.googlegroups.com...
[snip]
> We need to port this Ada code over, also.  We have decided, given that
> there is between 45 and 55 thousand lines of Ada code, with its
> attendant complexity, to simply use the Ada code as is without
> re-writing it into C++.  This Ada code depends on some files, also
> written in Ada, that then have some pragmas to a Visual C++ library,
> "winbase.h"...
>
> The Ada libs are;
>
> Win32
> Win32-Utils
> Win32-Winbase (pragmas to VCPP winbase.h lib)
> Win32-Windef
> Win32-Winnt
>
> Stdarg
> Stdarg-Impl
> Stdarg-Inst
> Stdarg-Machine
>

My first response is: it is unfortunate that the Ada code was programmed 
with direct dependencies to these interface modules (apparently) scattered 
about the system.  A better approach is to create a more generic binding to 
the system dependent interfaces to ease porting.

Given that you are talking about tens of thousands of lines of code, I would 
suggest attempting to create such an interface module with the existing 
code.  Remove all references to the existing Win32 and Stdarg stuff.  The 
compiler will help by telling you where things need to be "fixed up".

While this may sound like a daunting approach, in my experience this 
approach is not as bad as it sounds.  It's a bit tedious, but really doesn't 
take that long.  For example eliminating the "With" statements will 
immediatly identify things that need to be re-defined in an OS independent 
manner.  The first compile may give you a LOT of errors, but often fixing 
one error fixes many.  When a problem is identified, similar problems may 
often be corrected with a search and replace in an editor.

Steve
(The Duck)


> These are all Ada packages, and these name represent specs, and bodies,
> so named.
>
> So, we are going to have to compile the Ada code, then link it with the
> new C++ code.  We are using the Gnu-G++ compiler linker, and we will
> need to be able to link in the Ada object files with our C++ files.  We
> have to find a way to replace, or port, the mentioned Ada libs.
>
> The "Winbase" dependancy on the Visual C++ files is problematic, at
> best...
>
> So, again, any insight that can be provided would be greatly
> appreciated.  You can write me directly at
>
> Howard.Parrish@cisf.af.mil
> 





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

* Re: Porting Ada code to Linux
  2006-10-31 17:38 ` Howard
                     ` (5 preceding siblings ...)
  2006-11-01  3:28   ` Steve
@ 2006-11-01  9:03   ` Dmitry A. Kazakov
  6 siblings, 0 replies; 13+ messages in thread
From: Dmitry A. Kazakov @ 2006-11-01  9:03 UTC (permalink / raw)


On 31 Oct 2006 09:38:14 -0800, Howard wrote:

> I work with Bill, and I wanted to provide a more detailed expansion of
> our situation;
> 
> We are porting from a Windows-95 "legacy" system to a new Linux one.
> The code we are re-writing is Visual Basic, and we are translating it
> into C++.  But, the VB code had a dependancy on a considerable amount
> of Ada 95 code that the VB code interfaced with via DLLs.
> 
> We need to port this Ada code over, also.  We have decided, given that
> there is between 45 and 55 thousand lines of Ada code, with its
> attendant complexity, to simply use the Ada code as is without
> re-writing it into C++.  This Ada code depends on some files, also
> written in Ada, that then have some pragmas to a Visual C++ library,
> "winbase.h"...
> 
> The Ada libs are;
> 
> Win32
> Win32-Utils
> Win32-Winbase (pragmas to VCPP winbase.h lib)
> Win32-Windef
> Win32-Winnt

OK, that's Windows API interface. It is not language issue.

Depending on what was used in the application, there might be no chance to
port it at all. It is not Ada, but an OS-specific problem. Honestly, I know
no way to port, say, Window's SendMessage to Linux. It is just a totally
different architecture. Firstly you need Windows expertise. Your question
suggests that you don't have it. This makes the chances even lower than
zero. So, probably, as others have proposed, you should redesign the
program with OS-portability in mind. Ada offers you an excellent support
here.

There is another option, not mentioned before. I can't tell how realistic
it is, but anyway, there are Windows emulators for Linux. Wine is one. I
never used Wine, but it looks that apart from its main purpose of being a
Windows emulator, Wine also supports porting [for lazy ones (:-))]. I'd
suggest you to take a look at Winelib

http://www.winehq.org/site/docs/winelib-guide/index

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



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

* Re: Porting Ada code to Linux
  2006-10-31 14:17 Porting Ada code to Linux Bill
  2006-10-31 14:30 ` Georg Bauhaus
  2006-10-31 17:38 ` Howard
@ 2006-11-01 10:14 ` Alex Buell
  2 siblings, 0 replies; 13+ messages in thread
From: Alex Buell @ 2006-11-01 10:14 UTC (permalink / raw)


On 31 Oct 2006 06:17:46 -0800, I waved a wand and this message
magically appears in front of Bill:

> We have some code (about 60K lines) that was written for use on the
> Win95 platform as a collection of DLLs.  We are now in the process of
> porting the parent application to Linux and would like to reuse the
> Ada code.  The legacy code was written using the Aonix ObjectAda
> compiler/IDE and references packages like Win32 and Win32.Windef.
> 
> We have been able to move the code over to the Linux side and compile
> using the GNU Ada compiler.  However, to get this far we also had to
> copy the aforementioned "Win" packages over too.  Clearly, this seems
> like the wrong thing to do, but it did get the compile to work.  The
> problem is that we are receiving a fair number of linker errors that
> seem to point to the file winbase.h.
> 
> So, it seems like there should be a Linux equivalent of Win32, but we
> have not been able find it.  Can anyone point us to a replacement for
> these packages that will make the compiler AND the linker happy?  Is
> there anything else we should know about in our effort to complete
> this port?

The problem here is that you have no-one inhouse who knows anything
about Linux. Otherwise you would have been told a rewrite would be the
best thing to do. 

It's probably too late now, but can I suggest tasking someone with
rewriting the Win32 packages as a emulation layer? 

You could probably recoup the costs by selling the Win32 emulation
libraries to others porting to Unix from Windows...
-- 
http://www.munted.org.uk

You've been eating the cat food again, haven't you?



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

end of thread, other threads:[~2006-11-01 10:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-31 14:17 Porting Ada code to Linux Bill
2006-10-31 14:30 ` Georg Bauhaus
2006-10-31 17:38 ` Howard
2006-10-31 18:16   ` Martin Krischik
2006-10-31 20:29     ` Gautier
2006-10-31 20:21   ` Dr. Adrian Wrigley
2006-10-31 20:26   ` Michael Bode
2006-10-31 20:40   ` Gautier
2006-10-31 23:10     ` Dr. Adrian Wrigley
2006-10-31 20:41   ` Michael Bode
2006-11-01  3:28   ` Steve
2006-11-01  9:03   ` Dmitry A. Kazakov
2006-11-01 10:14 ` Alex Buell

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