[comp.windows.ms] Windows and Floating Point

kc@rna.UUCP (Kaare Christian) (01/27/89)

I am having trouble using floating point code in my windows programs.
(Env -- msc 5.1, new libraries from Genie which were called C5FIX,
the new Genie link4, win sdk1.04) When I used the original sdk 1.04
stuff, programs containing floating point don't run. There is no
explanation, you double click on the .exe and nothing happens. Same
prog minus the floating point works ok. I tried the -FPa and -FPi
varieties of floating point. With the C5FIX libraries and link4 (from
Genie) I can't get it to link correctly. Link4 complains that something
(__fptask??, I'm at work and the error messages are at home) is 
multiply defined. The link4 libraries are swin.lib and slibce.lib, and
the link4 switches are /NOD and /NOE.

Does anyone have a version of Hello that, for example, converts
pi (a double) to text and writes it to the screen??? Any known working
floating programs or suggestions would be appreciated.

Thanks,
Kaare Christian

kc@rna.rockefeller.edu

bturner@hpcvlx.HP.COM (Bill Turner) (01/31/89)

> I am having trouble using floating point code in my windows programs.
> (Env -- msc 5.1, new libraries from Genie which were called C5FIX,
> the new Genie link4, win sdk1.04) When I used the original sdk 1.04
> stuff, programs containing floating point don't run. There is no
> explanation, you double click on the .exe and nothing happens. Same
> prog minus the floating point works ok. I tried the -FPa and -FPi
> varieties of floating point. With the C5FIX libraries and link4 (from
> Genie) I can't get it to link correctly. Link4 complains that something
> (__fptask??, I'm at work and the error messages are at home) is 
> multiply defined. The link4 libraries are swin.lib and slibce.lib, and
> the link4 switches are /NOD and /NOE.

If you want to use the 8087 emulator library, there is a special version
that Windows can use.  You need to link with WIN87EM.LIB (an import library)
and WIN87EM.EXE must be around at runtime.  This supersedes the regular
C emulator library.

I've used this from a beta version of the Windows SDK, and it seems to
work fine.  Allowed the Mandelbrot program to use the 8087 installed.

--Bill Turner

vonzelow@adobe.COM (Jon von Zelowitz) (01/31/89)

In article <332@rna.UUCP> kc@rna.UUCP (Kaare Christian) writes:
>I am having trouble using floating point code in my windows programs.
>(Env -- msc 5.1, new libraries from Genie which were called C5FIX,
>the new Genie link4, win sdk1.04)

I just went through a conversion to 5.1, and I may have seen the same
problem. 

As I understand it, in K&R C, all floating point values passed between
functions are promoted to doubles. We had code which claimed in the function
headers and (old-style) prototypes to pass floats. That was OK in 4.0.

In MS C 5.10, the following happens:

- A warning message, "parameter <name> declaration different", is
printed. 

- The resulting code from the compiler DOES NOT work correctly.

In my opinion, this calls for more than a warning!

Try changing code to use doubles, or use ANSI prototypes to cure this.

See Microsoft Online Q29686. Good luck...

   ...sun!adobe!vonzelow   Jon von Zelowitz

dick@venera.isi.edu (Richard Gillmann) (02/09/89)

I've written lots of floating point code with MS C 5.1 and SDK 2.1 and
Link version 5.02 -- don't know about your setup.  I use the altmath
option exclusively (/Fpa on the C compile and slibca/mlibca).  You
have to be careful not to mix the emulator and altmath routines.
You might try linking with slibca and renaming slibce to something
else so it won't be picked up as a default somewhere.  Use the
/NOD switch as well.

pcb@usl.usl.edu (Peter C. Bahrs) (02/09/89)

In article <332@rna.UUCP>, kc@rna.UUCP (Kaare Christian) writes:
> I am having trouble using floating point code in my windows programs.
> (Env -- msc 5.1, new libraries from Genie which were called C5FIX,
> the new Genie link4, win sdk1.04) When I used the original sdk 1.04
> stuff, programs containing floating point don't run. There is no
> explanation, you double click on the .exe and nothing happens. Same
> prog minus the floating point works ok. I tried the -FPa and -FPi
> varieties of floating point. With the C5FIX libraries and link4 (from
> Genie) I can't get it to link correctly. Link4 complains that something
> (__fptask??, I'm at work and the error messages are at home) is 
> multiply defined. The link4 libraries are swin.lib and slibce.lib, and
> the link4 switches are /NOD and /NOE.
> 

Are you sure the libs in the C compiler are installed right (i.e. with
the correct math libs - 80..87 or emulator or alternative) and that
windows sdk was installed to rename theses libs with its version?

kyler@pyr.gatech.EDU (J. Kyle Rogers) (02/10/89)

In article <7470@venera.isi.edu> dick@venera.isi.edu.UUCP (Richard Gillmann) writes:
>I've written lots of floating point code with MS C 5.1 and SDK 2.1 and
>Link version 5.02 -- don't know about your setup.  I use the altmath
>option exclusively (/Fpa on the C compile and slibca/mlibca).  You
                     ^^^^
Watch out! The case-sensitive options gonna get ya!
That should read /FPa.  I spent about an hour ripping
my hair out trying to fix a problem once, before I
found this one-bit error in my makefile.

---krogers

|               krogers  --  J. Kyle Rogers  --  P.O Box 31467               |
|           Georgia Insitute of Technology, Atlanta Georgia, 30332           |
|uucp: ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!kyler|
|ARPA: kyler@pyr.gatech.edu                                                  |