[comp.windows.misc] Questions Re MS-Windows Dev Cost

davek@hp-lsd.HP.COM (Dave Kumpf) (09/16/88)

I have some (maybe stupid) questions regarding MS-windows development.
I'd like to play around with the MS-Windows environment, but the cost seems
ridiculous. (mail order -- $300 for MS-C, $350 for Windows SDK, $75 to 
upgrade my Windows from 1.03 to 2.01 ...) 

(alright, maybe it's not ridiculous, just more than I want to spend)  

1) Why is MS-C required?  It seems to me (not knowing enough about C) that
if you have a linker that understands the Windows LIB and  if your compiler
supports PASCAL calling sequences, you should be able to use that C 
compiler.  (Or does Windows depend on what the compiler does with registers?)

2) Does anyone have a Windows environment clone (public domain/shareware
or outright purchase) that is reasonably priced? Is anyone working on such
a clone? Borland!!? (Or are they really endorsing Open Look?)

3) If MS products are really the only alternative -- are there          
academic/student versions that are cheaper? 

Please email to me. Thanks for your help.

Dave Kumpf
hplabs!hp-lsd!davek

mguyott@mirror.TMC.COM (Marc Guyott) (09/22/88)

In article <8520002@hp-lsd.HP.COM> davek@hp-lsd.HP.COM (Dave Kumpf) writes:
>I have some (maybe stupid) questions regarding MS-windows development.
>I'd like to play around with the MS-Windows environment, but the cost seems
>ridiculous. (mail order -- $300 for MS-C, $350 for Windows SDK, $75 to 
>upgrade my Windows from 1.03 to 2.01 ...) 
>

Wait and purchase the 2.1 SDK.  This SDK comes with a version of CodeView
that will work with Windows.  I am a registered owner of a 2.01 SDK and I
recieved my official upgrade notice from Microsoft on the 9th of September.
If you acquired your 2.03 SDK before June 1, 1988 there is a $30.00 upgrade
fee.  I have called Microsoft and I am told it is possible to upgrade the
1.03 SDK to 2.1 for $100.00.

>
>1) Why is MS-C required?
>

Probably to supply the CodeView support for debugging.

>It seems to me (not knowing enough about C) that
>if you have a linker that understands the Windows LIB and  if your compiler
>supports PASCAL calling sequences, you should be able to use that C 
>compiler.  (Or does Windows depend on what the compiler does with registers?)
>

I would be curious to know what the answer to this question is.

>
>2) Does anyone have a Windows environment clone (public domain/shareware
>or outright purchase) that is reasonably priced? Is anyone working on such
>a clone? Borland!!? (Or are they really endorsing Open Look?)
>

I have heard that there is a product available called "Actor" that is supposed
to make Windows development easier.  I have never used or seen it but a few of
my friends use it and they swear by it.

>
>3) If MS products are really the only alternative -- are there          
>academic/student versions that are cheaper? 
>

Check out "Actor".

                                                Marc
----
       ... I never saw the morning until I stayed up all night ...
                               Tom Waits

Marc Guyott                                         mguyott@mirror.TMC.COM
{mit-eddie, pyramid, harvard!wjh12, xait, datacube}!mirror!mguyott
Mirror Systems	Cambridge, MA  02140                617/661-0777

mcdonald@uxe.cso.uiuc.edu (09/23/88)

>>It seems to me (not knowing enough about C) that
>>if you have a linker that understands the Windows LIB and  if your compiler
>>supports PASCAL calling sequences, you should be able to use that C 
>>compiler.  (Or does Windows depend on what the compiler does with registers?)
>>

>I would be curious to know what the answer to this question is.

The answer is that you absolutely must use Microsoft C and have the
Windows SDK to do C programming. In the first place, there is a special
"linker" called "link4" which reads not only object files but
something called a .def file which tells it whether segments are
fixed, moveable, discardable, etc., and informs it which C functions
are directly called by Windows. Those that are must use a special
calling sequence such that they can't be called directly from
your C code (if you, for example, ask for a code pointer you get an
entry point inside Windows itself; if you call that point Windows
will figure out where the routine really is and call it). I have now
done a lot of Windows programming and find that, after 8 months, it
gets relatively straightforward. Output is not bad at all, input
is messy and a nuisance, while memory management is an unholy terror
and a good reason to forget about the whole thing.

Once again, before you even consider buying the Windows SDK,
read the book "Programming Windows" by Charles Petzold. $24.95
at any Waldenbooks or B. Dalton (at least in this town they all carry
them).

Doug McDonald
 

greggy@infmx.UUCP (greg yachuk) (09/24/88)

In article <8520002@hp-lsd.HP.COM> davek@hp-lsd.HP.COM (Dave Kumpf) writes:
>1) Why is MS-C required?

It isn't.  You can use C, Pascal or Assembler.  There are several caveats:
i)	Windows uses Pascal calling conventions (e.g. reversing the stacked
	parameters, called function pops arguments).  All calls to Windows
	and all functions which will be called by Windows must adhere to this
	convention.

ii)	All callback functions must be FAR, even if the code is small or
	compact model.

iii)	All callback functions require a special Windows prolog and epilog.
	With MS C, you include it with the -Gw option (at compile time).
	You can probably determine what the prolog and epilog are from an
	include file (cmacros.inc) supplied with the SDK.  This file is
	used when developing in Assembler.

iv)	All Windows functions that use structures used PACKED structures.
	With MS C, you use the -Zp option.

v)	You must respect MS C return value conventions.  Things which can
	be represented in 16 bits are returned in AX.  Things which require
	32 bits are returned in DX:AX.  That is, DX has high-order 16 bits,
	AX has low-order 16 bits.

As you can see, you do not NEED MS C, but good luck finding any non-MS
language which fill all these criteria.

Note:  This information was gleaned from
	Microsoft Windows Software Development Kit Version 2.00
	Programming Tools, Chapter 2 "Cl, Pascal and the Macro Assembler"

>Dave Kumpf
>hplabs!hp-lsd!davek

Greg Yachuk		Informix Software Inc., Menlo Park, CA	(415) 322-4100
{uunet,pyramid}!infmx!greggy		why yes, I DID choose that login myself

bturner@hpcvlx.HP.COM (Bill Turner) (09/24/88)

> 1) Why is MS-C required?  It seems to me (not knowing enough about C) that
> if you have a linker that understands the Windows LIB and  if your compiler
> supports PASCAL calling sequences, you should be able to use that C 
> compiler.  (Or does Windows depend on what the compiler does with registers?)

MS Windows requires that certain prolog/epilog code be attached to FAR procedures
(no, not PROLOG; maybe prefix would be a better term?).  This code does some 
rather intersting setup for moveable/discardable code and moveable/multiple
data segments.

Microsoft does publish what the requirements are, but few compiler manufacturers
have bitten yet.  I've heard that Lattice C was going to be (or is) compatible
with MSW -- anyone know anything?

As was mentioned in another response, Actor is available, which is an OOP 
development system for MSW.  Haven't seen much of it other than playing with the 
first release (slow and big at the time, but easy to develope code).

--Bill Turner

nenicola@ndsuvax.UUCP (Steven Nicolai) (09/24/88)

In article <18185@mirror.TMC.COM> mguyott@prism.TMC.COM (Marc Guyott) writes:
>In article <8520002@hp-lsd.HP.COM> davek@hp-lsd.HP.COM (Dave Kumpf) writes:
>>I have some (maybe stupid) questions regarding MS-windows development.
>>
>>1) Why is MS-C required?
>>
>
>Probably to supply the CodeView support for debugging.

That is one reason.  The other reason is that Windows requires different
function prolog and epilog code.  There are actually three different
sets that could be used depending on how the function is called.  Petzold
talks about these in Chapter 8, Memory Management.  Basically there is
one convention for near procs called only from C, a different convention
for far procs called from C, and a third for far procs called from Windows.
(This last type includes window definition functions)  The compiler
actually emits the same code for that last two, and the LINK4 linker
changes the prolog and epilog code.

The near function prolog and epilog code is pretty standard.  The far
function code is kinda neat, they inc bp before pushing in on the stack.
This "feature" allows Windows to walk the stack back through the bp chain
and find all the functions.  They are then able to look at the bp value
on the stack, if it is even they know it was a near function call, if
it was odd, it was a far function call.

Why is this info needed you ask?  Windows swaps segments.  It can even
swap out a segment that has function with a stack frame that is active.
The return address to this function becomes invalid when that segment
is unloaded.  They replace the return address with the address of the
"reload" thunk for the function that was called.  (And you always wondered
why MS-Windows ran sooooo slow....:-)

>>It seems to me (not knowing enough about C) that
>>if you have a linker that understands the Windows LIB and  if your compiler
>>supports PASCAL calling sequences, you should be able to use that C
>>compiler.  (Or does Windows depend on what the compiler does with registers?)

>I would be curious to know what the answer to this question is.

I think this is answered above.  One more comment, Supposedly ZorTech
is working on Windows support for their C++ compiler.  All that is needed
is a switch to turn on this different prolog - epilog code for far functions,
and to follow the MS C calling conventions.  Neither of these sound too
difficult to do.

STeve
-- 
Steve Nicolai                    USMAIL:   1717 40th St SW Apt 106
ARPA & UUCP: nenicola@plains.NoDak         Fargo, ND  58103
BITNET:      nenicola@ndsuvax              (701)-281-1230