[comp.windows.ms.programmer] New Zortech C++/Windows 3.0 Developer...

jordan@aero.org (Larry M. Jordan) (02/16/91)

I am a new Windows 3.0 developer using Zortech C++.  I've run up
against what I will call a beginner's configuration problem.  I recently bought
Petzold's book and keyed in ENVIRON.C which references "environ" in the
code.  This is a pointer to the environement.  It wouldn't compile.
The file includes <stdlib.h> where "environ" is supposed to be
defined.  It is, but in \windev\include\stdlib.h, and not in
\zortech\include\stdlib.h which is what I am getting since I have my
INCLUDE env. var is set to Zortech's.  I redefined INCLUDE to be only
the SDK includes and Zortech complained about a decl. using the
volatile keyword... My question:  What must I do?  Must I go in
and "condition" any SDK header file so that it finally pleases the
Zortech compiler, or do I use the Zortech supplied header file and
change "environ" to reference the Zortech pointer to the environment
(envptr)?  Or what?  How should things be configured?

This raises another question:  What if I want to use some of the
Zortech libraries.  Can I along with the windows libraries?  What
problems must I look out for?

--Larry

johnm@spudge.UUCP (John Munsch) (02/19/91)

In article <1991Feb15.224409.23871@aero.org> jordan@aero.org (Larry M. Jordan) writes:
[Deleted discussion of problems with stdlib.h and environ pointer]

>volatile keyword... My question:  What must I do?  Must I go in
>and "condition" any SDK header file so that it finally pleases the
>Zortech compiler, or do I use the Zortech supplied header file and
>change "environ" to reference the Zortech pointer to the environment
>(envptr)?  Or what?  How should things be configured?

I would not attempt to use the includes that appear in the windev\include
directory other than windows.h.  I would try to make Petzold's code work
with whatever Zortech is using as a pointer to the environment.  That will
work better than trying to kludge something of Microsoft's to work with
Zortech.

>This raises another question:  What if I want to use some of the
>Zortech libraries.  Can I along with the windows libraries?  What
>problems must I look out for?

I use ONLY Zortech's libraries (with the exception of libw obviously).
I had no end of troubles trying to make slibcew, etc work with Zortech
and then I found a file on Zortech's BBS (206)822-6907 called WIN3KIT.COM.
All it does is take your zl?.lib files and combine them with the libs
that came with the SDK to produce libraries that work excellently.  All I
typically link with is libw.lib, zlsw.lib, and pls.lib.  This way if you
link with a tool library you shouldn't have any problems.

John Munsch
Q: Why did Microsoft codename Basic for Windows Thunder?
A: Because they couldn't call it Lightning.

bright@nazgul.UUCP (Walter Bright) (02/26/91)

In article <1991Feb15.224409.23871@aero.org> jordan@aero.org (Larry M. Jordan) writes:
/I am a new Windows 3.0 developer using Zortech C++.

In general, since you will be linking with the Microsoft libraries from the SDK,
you will need to use the .h files supplied by the SDK. Make sure those are found
in the include path before the Zortech ones.

Secondly, make sure the SDK libraries are in the command to LINK before the
Zortech libraries, and use the /NOE switch to LINK to make sure it accesses
the libraries in the right order.

The main problems to watch out for:
MSC and ZTC return floats and doubles using different mechanisms. Thus, avoid
trying to link together a module compiled with ZTC and one with MSC that
returns floats or doubles between them.
Some SDK sample code uses // comments in C code. This is not accepted by ZTC
(although it is accepted by ZTC++). // comments are not ANSI C.
Some SDK sample code uses incorrect prototypes, as in:
	void func(short i);
	void func(i)
	short i;
	{ ... }
These declarations are incompatible (the short is promoted to an int in the
second form due to ANSI C rules), the fix is to use the fully prototyped form:
	void func(short i)
	{ ... }

I hope this will get you started successfully.