[comp.sys.atari.st] Alcyon C printf

Peck@RADC-MULTICS.ARPA.UUCP (03/11/87)

  I've isolated a problem I'm having with the Alycon C compiler.  I
earlier posted a note about not getting anything printed when make ran
(wether it was supposed to do anything or not).
  Well, I've written a smallest failure case program here.  It looks
like this:  
-------
#include <stdio.h> 
main() 
{
  printf ("Hello\n"); 
} 
------------ 
This program compiles and links perfectly with gemstart.o, gemlib, libf and 
osbind.  When I run it, the machine pauses around 1 second, then returns.
It returns without printing a thing!
Changing the program to:  
----------- 
#include <osbind.h> 
{
  Cconws ("Hello\n"); 
} 
----------- 
and compiling makes a program which works.  Unfortunately Cconws doesn't do 
the parameter stuff, and it would be nice to have a c that can do standard 
output calls.

  I think this problem is a big part of the make not working problem
I've been having.
  Anyone able to help?
    rodney
 Peck@Radc-Multics.arpa

leavens@atari.UUCP (03/11/87)

> 
>   Well, I've written a smallest failure case program here.  It looks
> like this:  
> -------
> #include <stdio.h> 
> main() 
> {
>   printf ("Hello\n"); 
> } 
> ------------ 
> This program compiles and links perfectly with gemstart.o, gemlib, libf and 
> osbind.  When I run it, the machine pauses around 1 second, then returns.
> It returns without printing a thing!

  Is this a .PRG that you're running from the desktop?  I once had the same
problem, and it turned out that it _was_ printing something--it was just 
doing it so fast and returning to the desktop that I never saw it.

  (If you're running this program from a command line, then of course
this isn't valid).

  Anyway, I've been using printf calls in my TOS programs (using the
Alcyon compiler) with no trouble at all.  Would you like a source fragment?

--alex @ Atari

BIX:alexl.            GEnie: ALEXLEAVENS      AtariCorp: 408-745-2006

"How can you be in two places at once when you're not anywhere at all."

bammi@cwruecmp.UUCP (03/11/87)

In article <870311005543.569911@RADC-MULTICS.ARPA> Peck@RADC-MULTICS.ARPA (Rodney) writes:
>
>  I've isolated a problem I'm having with the Alycon C compiler.  I
>{
>  printf ("Hello\n"); 
>} 

What version of Alcyon are you running? Did you fix gemstart.s to have
a decent stack size? Did you specify the -f switch to the first pass of the
compiler, before using libf? Did you mix libraries from the earlier version
and v 4.14 (WARNING: ATARI was responsible for this mix up in some of the
releases they sent out for v4.14, they packaged the old libraries with the
new compiler, I learnt this the hard way). In some very very early versions
you  had to have printf("Hello\r\n"), but that was fixed before even v 4.14.
Alcyon certainly works just fine (except for scanf and getchar, the fix to which
has been over this newsgroup atleast twice).
  
-- 
usenet: {decvax|cbatt|cbosgd}!cwruecmp!bammi		jwahar r. bammi
csnet:       bammi@case
arpa:        bammi%case@csnet-relay
compuServe:  71515,155

Peck@RADC-MULTICS.ARPA (Rodney) (05/18/87)

  Ok, here we go again.  After my last request for information about why
the printf function DOESN'T WORK in alcyon C, I received many replies
which said that they just used sprintf + Cconws.
  Forgive me if I'm irrational, but I paid 300 dollars, I'd like to able
to use the printf function.  Its OUTRAGEOUSLY common in C programs to
call printf.  It tends to be a hindrance to not be able to use it.
  Now then, could those of you (including Atari) who got the bloody
thing to work _please_ send me a piece of code which uses it and does
compile and does work.  A list of the files you linked and in what order
would be nice too.
  Thanks,
  Rodney Peck
 
Disclaimer: There are no opinions expressed in the above text.

bammi@cwruecmp.UUCP (Jwahar R. Bammi) (05/20/87)

In article <870518190028.128932@RADC-MULTICS.ARPA> Peck@RADC-MULTICS.ARPA (Rodney) writes:
>
>  Ok, here we go again.  After my last request for information about why
>the printf function DOESN'T WORK in alcyon C, I received many replies
>which said that they just used sprintf + Cconws.

I dunno. Printf always worked for me. I assume you have v4.14 of the compiler
and the new libraries that came with it.

	If you are using the motorola fast floating point libraries, ie.
you are specifying the `-f' option to C068,  link as follows

	lo68 -r -s -o foo.68k gemstart.o foo.o gemlib libf
  or
	link68 foo.68k=gemstart,foo,gemlib,libf

	If you are using the IEEE floating point libraries, ie. you DO NOT
specify the `-f' option to C068, link as follows

	lo68 -r -s -o foo.68k gemstart.o foo.o libm gemlib
  or
	link68 foo.68k=gemstart,foo,libm,gemlib

	Note that libm comes before gemlib, otherwise you pick up
the incorrect version of printf from gemlib for the IEEE format.


If you are using no floating point, AND you are compiling with the
`-f' option, you can skip linking in libf by defining dummy 
etoa, ftoa, atof symbols, thereby satisfying the linker, and saving
yourself a couple of bytes.
							hope that helps,
-- 
usenet: {decvax,cbatt,cbosgd,sun}!cwruecmp!bammi	jwahar r. bammi
csnet:       bammi@case
arpa:        bammi%case@csnet-relay
compuServe:  71515,155

frank@exunido.UUCP (05/27/87)

printf() works properly on OPENED streams only, so ensure that stdin is
OPENED. This job is normally done by the startup module gems.o. The
startup modules apstart.o and accstart.o (maybe gemstart.o too, don't know
it exactly) DO NOT open stdin, stdout and stderr.

Hope this is a help.

frank@unido.uucp
     @unido.bitnet