Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Bailey O.H.Embedded systems.Desktop integration.2005

.pdf
Скачиваний:
70
Добавлен:
23.08.2013
Размер:
9.53 Mб
Скачать

130

Chapter 5 / Developing the Desktop User Application

 

 

native API of the host system. The benefits here are very clear:

.NET eliminates the need to develop multiple applications and the same executable can be run on any platform. The plug (application) now fits any wall socket (operating system). In the following illustration, the same user application is run on all three versions of the .NET framework.

User Application

Intermediate

Code

Native Code

 

Native Code

 

Native Code

 

 

 

 

 

 

 

.NET Framework

 

 

.NET Framework

 

 

.NET Framework

 

 

 

 

 

 

 

API Layer

 

 

API Layer

 

 

API Layer

 

 

 

 

 

 

 

Kernel

 

 

Kernel

 

 

Kernel

 

 

 

 

 

 

 

Device Driver

 

 

Device Driver

 

 

Device Driver

 

 

 

 

 

 

 

Hardware

 

 

Hardware

 

 

Hardware

 

 

 

 

 

 

 

UNIX .NET

 

Linux .NET

Windows .NET

Figure 5-12

Including Microsoft, there are at least three .NET efforts going on. They are .NET from Microsoft, GNU.NET from The Open Group, and Mono, an open-source project sponsored by Novell. There are several private efforts also going on, but these three are the most widely available. The Microsoft implementation is complete and has been shipping for over two years. GNU.NET appears to be at the midpoint of development. While a lot of the core library is completed, not all of the functionality found in the Microsoft version has been implemented yet. So far GNU.NET is being developed and tested on Linux only. Mono is available on both Windows and Linux but again is not yet fully implemented.

Chapter 5 / Developing the Desktop User Application

131

 

 

While .NET should certainly be considered for the future, in its current state it doesn’t meet our cross-platform requirements.

Cross-Platform Compilers

The next choice in cross-platform development is the compiler. Again we have a mix of commercial and free open-source products. In some cases, cross-platform compilers include a version of a cross-platform library. Before we get too far into this topic let me define what a cross-platform compiler is as it pertains to this project.

A cross-platform compiler includes a development interface that allows the developer to edit, compile, and debug a program using the same source code and with the same functionality in an identical fashion on all supported platforms. This does not preclude the fact that platform-dependent features are also included, but the same source must be compiled the same way to produce a same-looking application on all platforms from the user interface perspective. Database tools are not included since each platform has database systems available that are not cross-plat- form compatible. With these requirements in mind, the field of available products has been narrowed considerably. Let’s look at the contenders.

Borland Products

Borland has several products that meet our requirements. This company has been developing commercial software products for over 20 years starting with Turbo Pascal. Over the years these products have evolved, and today Borland offers Pascal and C++ compilers that are cross-platform compatible. In fact, Borland is the only company to provide language-compatible compilers for Windows, UNIX/Linux, and .NET. Both C++ and Pascal are supported in the Windows and Linux markets.

Chapter 5

132

Chapter 5 / Developing the Desktop User Application

 

 

Delphi

The flagship product of Borland, Delphi is what Turbo Pascal has evolved to be. Delphi has set the standard for adding object-ori- ented architecture to the Pascal language. I’ve use Turbo Pascal and Delphi since their inception and have always found both products to be of exceptional quality. The Linux version of Delphi is named Kylix. Delphi and Kylix have identical development environments. Figure 5-13 shows the Delphi 7 development environment for Windows. Notice the familiar Windows desktop.

Figure 5-13: Delphi 7 version

Chapter 5 / Developing the Desktop User Application

133

 

 

Now take a look at Figure 5-14.

Figure 5-14: Kylix 3

This is Delphi Kylix running on Linux and KDE. The editor and visual designer are identical in functionality. While the Linux Desktop Manager looks similar, you’ll notice the toolbar at the bottom is different. You’ll also notice that both screens show the same application. While they look very similar, each is native to the operating system it is running on.

Delphi/Kylix meets the requirements of our project; however, our developers may not be completely comfortable with using Pascal. So let’s move on to another commercial product.

Chapter 5

134

Chapter 5 / Developing the Desktop User Application

 

 

C++Builder

Yes, another Borland product. I’m getting all the compilers from Borland out of the way before moving on to the next vendor. C++Builder began as Borland C and has evolved (like Delphi) into a very mature and stable compiler. The current versions of C++Builder are 6 and 2005; they share the same editor and visual designer as Delphi. The good news is that they are full C++ implementations. The following is a screen shot of C++Builder 6 for Windows.

Figure 5-15

Chapter 5 / Developing the Desktop User Application

135

 

 

Like Delphi, C++Builder is also available for Linux. The following is a Linux image of C++Builder.

Figure 5-16

Again, except for the desktops, both the Linux and Windows versions of C++Builder look and function identically.

Our requirements call for the application to run on Linux, Windows, and UNIX. So far, Delphi and C++Builder have proven to work on Linux and Windows, but we haven’t seen a UNIX version. Neither of these products has a native UNIX version. The version of UNIX we are using (FreeBSD 5.1) includes the ability to run a Linux binary. Rather than having three separate programs, we will install the Linux version of the application on the UNIX host.

Chapter 5

136

Chapter 5 / Developing the Desktop User Application

 

 

Intel C++

Intel is not new to the compiler market. Many years ago they developed and sold 16and 32-bit DOS compilers that came complete with a DOS extender. Intel eventually sold that compiler off and stayed out of the compiler business for a while, but they have recently gotten back into the commercial compiler business. It makes sense for the people who make the processors to also make a compiler. The Intel C++ compilers are available for Windows and Linux platforms also. Like the Borland compilers, the Intel products work identically on both platforms. It should be noted that the Intel compilers do not include an editor or visual designer. They are command-line compilers only. The package includes a make utility, command-line compiler, linker, and debugger along with electronic versions of the documentation.

While it may appear that not including these items puts Intel at a disadvantage, nothing could be further from the truth. On Windows the Intel compiler is a direct replacement for Visual C++ 6 and the .NET compilers from Microsoft. On the Linux platform the Intel C++ compiler is a direct replacement for the GNU compiler, which is included with Linux. The Intel compiler package for Linux includes a make file utility, compiler, linker, and debugger.

The GNU Compiler Collection (GCC)

Next we have the GNU Compiler Collection, or GCC for short. The GNU compilers are free and have been around a very long time. Unlike the prior products, however, these compilers are supported strictly by volunteers. I submitted a question and was told that it could take up to two weeks to get a response. I never received a response to my question. Aside from support, the GNU compiler collection has several advantages over other compilers. First, the collection is available for many different processors other than Intel. Motorola, Hitachi, and many others are also supported. Second, the code is very mature and works well, and bugs are documented very well. The GNU compilers

Chapter 5 / Developing the Desktop User Application

137

 

 

usually generate larger executables that run slower than commercial products. The GNU compiler collection also allows one platform to host a cross-compiler for another so at least in theory you can generate all your programs on a single machine. Now the downside: The GNU compiler collection has very scattered documentation and some of that documentation is wrong. When I had problems generating a cross-compiler, I found three different explanations for the cause of the problem, none of which was correct. This is the result of documentation on some of the more infrequently used functions not being updated. I used version 3.3.2 and the most recent documentation for cross-compiling I found was for 2.9.5.

Second, there is no visual designer for building a GUI, although there are many visual designers that support the GNU compiler. The GNU compilers run on Windows but require additional software that supports UNIX commands to operate. There are currently two of these UNIX shells available — Cygwin and MinGW. Either included or available for download are C, C++, ADA, Fortran, Objective C, Java byte code, and Java binary code compilers. Also included are all the tools for building, compiling, assembling, and debugging. The compiler suite includes source code so you can extend a language or write your own if you wish. The ability to build cross-platform compilers and create executable programs for a multitude of systems on a single host is a very big benefit. The support of some of the more obscure processors is another benefit. The GNU compilers generate professional-quality code and include a professional-quality debugger.

The biggest setback I had was finding a good editor that worked on all the selected platforms and the limitation of using visual designers that worked on all platforms (that were not dependent on a platform-specific framework). The next topic explores these types of utilities in more depth. If you choose to use the GNU compilers, I strongly recommend paying particular attention to available tools that support them. I also recommend doing a thorough evaluation of the available editors and visual designers before selecting one to use. It’s easier to change those

Chapter 5

138

Chapter 5 / Developing the Desktop User Application

 

 

tools before spending the time to learn them and then throwing that time away.

Commercial Compilers in Comparison

There are several cross-platform compilers available to the development community. Borland and Intel are both first-class products. If you’re developing a number of desktop applications, the Borland tools are a worthwhile investment for the time you’ll save in designing interfaces. If you’re not developing desktop applications, you may find the Intel compilers to your liking, but remember that they are command line only. The GNU compiler suite supports more platforms and supports hosting cross-plat- form code generation. I use all of these products and find each valuable depending on my objective. The following table gives a comparison.

Table 5-2: Comparing compilers

Product

Language

Forms

Source

Open

UNIX/

Windows

Price

 

 

Designer

Included

Source

Linux

 

 

 

 

 

 

 

 

 

 

Intel C++

C, C++

No

No

No

Yes1

Yes

$399

7.0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C++

C, C++

Yes

No

No2

Yes1

Yes

$399 to

Builder 6

 

 

 

 

 

 

$2,999

 

 

 

 

 

 

 

 

Delphi 7

Pascal

Yes

No

No2

Yes1

Yes

$399 to

 

 

 

 

 

 

 

$3,499

 

 

 

 

 

 

 

 

GNU C++

C, C++

No3

Yes

Yes

Yes

No4

N/A

Notes:

1.Runs on FreeBSD in Linux mode

2.Personal version available at minimal charge

3.Not included; third-party support

4.Cygwin or MinGW required to compile under Windows

There are several options available when it comes to compilers for cross-platform development. Determining factors are processor, integrated tools, visual designer, and platforms supported.

Chapter 5 / Developing the Desktop User Application

139

 

 

Cross-Platform Development

Environments

This is our final category to examine before doing our final comparison. The reason for this category is twofold. First, there are cross-platform products that are neither compilers nor frameworks. Second, these tools are productivity enhancers that operate in a consistent fashion across multiple platforms. This category includes editors and development environments. Our first category is integrated development environments (IDEs). So let’s get started with our options.

C++BuilderX

Here we go again. Now you may be asking why this wasn’t covered above; that is a reasonable question. C++BuilderX is actually several products. It contains Borland C++ and the Intel C++ compilers for Windows and Linux, and supports the GNU C++ compiler and Microsoft Visual C++. It is also an open architecture IDE that works on Windows, Solaris, and Linux. Finally, the product includes the ability to do source level debugging on any of the supported platforms. It’s not just a compiler suite but rather a complete architecture. While C++BuilderX does not currently include a visual designer, a preview version for Windows does include a visual designer for wxWindows. The following illustration shows the preview version running under Windows.

Chapter 5

Соседние файлы в предмете Электротехника