[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

3637.0. "no console workbench startup" by MILKWY::JANZEN (Tom 2285421 FXO/28 Franklin MA) Fri Mar 30 1990 15:13

    How do I make a workbench-started icon-started program with a window
    so that no cli-like console window is created?
    What is cres.o?  When I name main _main it won't link due to duplicate
    names.  When I use define _main=_tinymain it won't link due to
    duplicate names.  When I include workbench/startup.h it does nothing,
    that's only for the parameter input structure, which I don't need, but
    I suppose I should put in.
    
    I am using lattice C 5
    Thanks
    Tom
T.RTitleUserPersonal
Name
DateLines
3637.1Now why wouldn't you want a window?PEBBLE::mwmMike (Real Amigas have Keyboard Garages) MeyerFri Mar 30 1990 22:3245
This is probably the most commonly asked question on the Lattice BBS. It's
what they get for creating the window for you.

Just as a note, the window exists so that standard input, standard output,
and standard error have someplace to go. If you use any of those IO streams,
any of the technics listed below to make the window go away will also throw
those out. This window comes from the Lattice start up code, and not from
something else inside the Amiga.

1) The official method: Add a define to your linker command file, either
define __main=__tinymain
	- or -
define @_main=@_tinymain

use the latter if you expect main to be compiled with registerized parameters
or not. Note that I _never_ use this method, so can't attest to how well
it works.

2) In the sources distributed with the compiler, find umain.c, or _umain.c,
or maybe _main.c (sorry, don't have the stuff handy). Compile it -dTINY, and
link the resulting .o file in before the amiga libraries.

3) The QAD method - add the line:

int _main(char *line) { return _tinymain(line); }

to your program.

Those are the ways to ditch that window. I favor the second, but only because
I like hacking up the _main.c for other reasons.

As for cres.o - it's a version of c.o. C.o contains the _very_ low-level
startup code, and eventually invokes _main (C source found in the *main.c
mentioned above). There are four versions on the C disk:
	
	c.o - standard startup
	catch.o - same as above, but attempts to dump a stack trace on GURUs
	cres.o - has magic so that the resulting program can be made resident
	catchres.o - both the above two in one package

As for workbench/startup.h, it doesn't add any code to do things for you. It
just defines structures and constants for manipulating the workbench startup
message (and probably more, but that's the important one for me).

	<mike
3637.2got it to workMILKWY::JANZENLife's beautiful from a DistanceMon Apr 09 1990 14:016
    OK thanks Mike that works great.
    My mistake had been using _main instead of __main etct.
    I used the define at link technique.
    I remember reading the clarification somewhere about _main being _main
    becuase of the way the manual was typeset, but had forgetten.
    Tom