[comp.sys.amiga] lattice cback.o question

arian@dnlunx.pttrnl.nl (Koster A.) (05/08/90)

I'm posting this for a friend so please reply to:
ap_vrooijen@pttrnl.nl

----------------------------------------------------

Hello World,

At the moment I'm experimenting with cback.o startup routine from
lattice 5.02. I thought when you close the _Backstdout filehandler you
can close the window in wich you started the command. But I can't get
it to work. The window only closes when the command is finished. I
wrote a litle test program to test it. I compile and link it with the
following commands :

LC test
BLINK FROM LIB:cback.o+"test.o" TO "test" LIB LIB:lc.lib LIB:amiga.lib BATCH

When I execute test; endcli  the cli window will print "HELLO WORLD"
"Shell 2 ending". The shell window will only disappear when the delay
loop is finished.

WHAT AM I DOING WRONG ????????????????????????

I hope you can help me

------------------------> test program <--------------------------------
#include <exec/types.h>
#include <exec/libraries.h>
#include <string.h>
#include <proto/dos.h>

long _stack = 4000;
char *_procname = "my_program";
long _priority = 0;
long _BackGroundIO = 1;
extern long _Backstdout;

#define MSG "HELLO WORLD\n"

void main()
{
	long i;
	Write(_Backstdout, MSG, strlen(MSG));
	Close(_Backstdout);
	for (i=0;i<5000000;i++);
}


 -- 
                        Arthur van Rooijen
 
 PTT Research Neher Laboratories,	 Phone  : +31 70 3325092
 2260 AK Leidschendam,			 Telefax: +31 70 3326477
 P.O. box 421,			         Telex  : 31236 prnl nl
 The Netherlands.

 Domain          : ap_vrooijen@pttrnl.nl 
 EARN/BITnet     : ROOIJEN@HLSDNL5.BITNET
 PSS (DATAnet1)  : +204 117035801::ROOIJEN

valentin@cbmvax.commodore.com (Valentin Pepelea) (05/09/90)

In article <1207@dnlunx.pttrnl.nl> arian@dnlunx.pttrnl.nl (Koster A.) writes:
>
> At the moment I'm experimenting with cback.o startup routine from
> lattice 5.02. I thought when you close the _Backstdout filehandler you
> can close the window in wich you started the command. But I can't get
> it to work.
>
> ...
>
>long _stack = 4000;
> char *_procname = "my_program";
> long _priority = 0;
> long _BackGroundIO = 1;
> extern long _Backstdout;
>
> #define MSG "HELLO WORLD\n"
>
> void main()
> {
>	long i;
>	Write(_Backstdout, MSG, strlen(MSG));
>	Close(_Backstdout);
>	for (i=0;i<5000000;i++);
> }

The problem is not with you, but rather the documentation. Replace the line
"void main()" with "void _main()". It's that simple. One of these days, I'll
call Lattice and tell them about the error. I myself have spent half a day
on that one.

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be