MESSAGE
DATE | 2004-09-04 |
FROM | Ruben Safir Secretary NYLXS
|
SUBJECT | Re: [hangout] Re: Advocacy vs. Zealotry vs. Who Cares?!?
|
Billy > I don't see how this is MSFT's fault.
Ruben > > That's actually easy to answer. > > 5 yard penalty: incomplete quoting of context. Billy > (WHAT is MSFT's fault, again?) >
There are no yards in Baseball...
The response it to the security faults of the MS foundation Class.
Ruben> > On the windows OS everything works as a single process without kernel > > specific file permisions on any of the systems foundation libraries. Billy > I can't extract a coherent technical argument from this sentence. > I tried.
Billy > What are "kernel-specific file permissions" ?
The kernel in Linux assigns and allocates resources according to user permisions and ALL processes must have a UID and an EUID attached to them.
In windows there is only 1 process and everything is a thread.
I've looked at this very closely in the last 3 weeks, especially in regard to porting GTK programs and C programs to Windows. It's a huge problem. everything in windows runs as Windows.
Ruben > > So when you start a new program in Windows, becomes > > a thread of the core OS, Billy > > Stop this FUD!
It's not fud. It's a fact. See the gtk porting website.
> No, this is hardly true of all or most software. >
Actually it is. Even Visual Basic applications which leverage heavely the MSFT installs new DLL's and replaces old ones willie nillie.
Also see http://www.linuxjournal.com/article.php?sid=7128 -------------------------
Like most people who read Linux Journal, I am a rabid fan of all things Linux, GNU and open source. I run Linux on all of my personal machines, program on them, play on them and evangelize to others whenever possible. But, a large portion of the programming jobs out there involve writing applications for an operating system from Redmond, Washington.
For my job, I've had to write some smaller applications for the Microsoft Windows platform. Because speed of execution was an issue, I was going to have to write them in C, directly using the Win32 API. It occurred to me that if I was going to be using a standard language such as C, I might be able to develop in my nice and cozy Linux home.
This article is a short guide on developing an application for Windows completely within a Linux environment. I give a short introduction to Windows programming and step through compiling and testing a sample program. I also discuss Wine to simplify porting Windows source code to Linux. Win32 Programming
For those of us raised on the wholesome nutrition of a UNIX-style process abstraction, the Windows model might seem downright heretical. The Windows model is a preemptive, multitasking, multithreaded, message-passing operating system. I'm limiting myself here to NT and its derivatives, 2000 and XP. All processes are considered threads by the operating system. This makes the process context slightly lighter than the traditional heavyweight process model used in UNIX-like operating systems. As a consequence of this everything-is-a-thread model, however, everything sits in global memory address space. With the correct permissions and the correct address, one program could twiddle another program's bits.
Another consequence of this is data structures created by the kernel don't sit at any fixed address. This means it is up to the user program to lock down the associated memory before using any global data structures, such as graphic contexts. You also must remember to unlock these structures once you are done with them, or they may help cause memory fragmentation.
Listing 1, available from the Linux Journal FTP site (see the on-line Resources section), is a basic Hello World program. Most of it is boilerplate, and only the portion within the switch statement is of any real interest. It does seem like quite a bit of code for a basic program, but that is the problem with using a low-level API. A good comparison on Linux would be writing code for X using Xt.
Instead of a main() function, a Windows GUI program starts at WinMain(). It's in this function that your program does all of its initialization. Part of this initialization includes defining the window class for the main window and associating a callback function for it. Next, create the main window and show it on the desktop. Control then passes to the message loop, and the callback function processes the messages that are sent to the main window.
A good quick introduction to writing Windows programs is available from winprog.org (see Resources). The authors of this Web site offer a good FAQ and a fairly good tutorial covering all of the basics. Of course, the bible for Windows programming is the massive book Windows Programming, by Charles Petzold. If you can't find what you need in this tome, you always can use it to beat the information out of your friendly neighbourhood Windows guru. Cross-Compiling
One of the amazing things about GCC is that it has been ported to so many different platforms and operating systems. A great gift that comes from this is the ability to compile binaries on one platform that are destined for a completely different one. I regularly compile binaries for Solaris or Windows on my Linux laptop. This is an amazing advantage, allowing development to occur in a familiar, comfortable environment.
The purest way to set up is to go back to the source (see Resources). This way you can compile code with the exact settings and for the exact platform you want. Thankfully, this work has already been done. The good people at the MinGW Project maintain a port of GCC for compiling Windows binaries. This includes all of the associated files, such as the headers. The sources are available here along with binary tarballs. These programs also have been packaged for RPM-based and deb-based distributions. If you are running Debian, you can use apt-get to retrieve the mingw32 and mingw32-runtime packages. If you are running testing or unstable, you also should grab mingw32-binutils.
Most of the compilation options in GCC are available here in MinGW, along with a few extras. If you simply compile a program without any extra options, it can be run from the console. This is what you would do if you wanted to write a small, simple program that did not need a GUI. Because this is Windows, we want a GUI program, so we write all of the required boilerplate we saw above and add the -mwindows option to the compilation command. This sets up the macros and library links you need in order to compile a standard Windows executable. If you decide to write a more complicated Windows program that uses some other Windows' feature, you need to add in the libraries explicitly that you want linked.
In Windows you can define resources for your program. These include such items as menus, bitmaps and text strings, among others. These resources are defined in a separate file and need to be compiled separately before being linked to your executable. That job falls to the program mingw-windres, which creates an object file you subsequently can link to your executable.
To compile our simple example program shown in Listing 1, we use the command:
mingw-gcc -o example1.exe example.c -mwindows
Replace the command mingw-gcc with whatever the package maintainer called the compiler executable for your package. Presto, you now have a Windows program ready for the world. Or is it? Debugging with Wine
-- __________________________ Brooklyn Linux Solutions
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://fairuse.nylxs.com
http://www.mrbrklyn.com - Consulting http://www.inns.net <-- Happy Clients http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....
1-718-382-0585 ____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
-- __________________________ BrooklynLinux Solutions
Somany immigrant groups have swept through our town thatBrooklyn, like Atlantis, reaches mythological proportionsin the mind of the world - RI Safir 1998
DRMis THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://fairuse.nylxs.com
http://www.mrbrklyn.com- Consulting http://www.inns.net<-- Happy Clients http://www.nylxs.com- Leadership Development in Free Software http://www2.mrbrklyn.com/resources- Unpublished Archive or stories and articles from around the net http://www2.mrbrklyn.com/downtown.html- See the New Downtown Brooklyn....
1-718-382-0585 ____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|