[comp.sys.mac.programmer] Hello, World #2 again

jp48+@andrew.cmu.edu (Jonathan Pace) (02/25/91)

   I've fixed my compilation problem (needed MacHeaders) but now I get a fatal
error.  While running my code, it gets a "bus error" on the line WindowInit()
below:

main()
{
    ToolBoxInit();
    WindowInit();
    while ( !Button() );
}

Suggestions?

Jon Pace

pardue@gn.ecn.purdue.edu (Jon Pardue) (02/27/91)

In article <Abm_Nvm00WB5ED6UN1@andrew.cmu.edu> jp48+@andrew.cmu.edu (Jonathan Pace) writes:
>
>While running my code, it gets a "bus error" on the line WindowInit()
>below:
>
>main()
>{
>    ToolBoxInit();
>    WindowInit();
>    while ( !Button() );
>}
>
>Suggestions?
>
>Jon Pace

I had this type of problem, too.  I had two segments set up in the THINK C
segment window (one was too small for my code + the ANSI library), one 
containing all of my source and one containing the ANSI stuff.  I always got
a bus error.  I fixed it somehow by dragging the section(s) of my code that
performed memory management down into the same segment with ANSI.  That worked,
although if anyone can explain it to me I will be grateful!  :-)

I don't know if this will help; please let me know.  It does seem odd that
something like that should matter, but then again I'm new to this platform
too!

- Jon
-- 
----------------------------------------------------------------------------
Jon Pardue                            "The plural of 'spouse' is 'SPICE'."
pardue@gn.ecn.purdue.edu                                  - me
"Old musicians never die, they just go from bar to bar." - Anonymous

delann@cs.umu.se (Anders Nyman) (02/27/91)

In article <Abm_Nvm00WB5ED6UN1@andrew.cmu.edu> jp48+@andrew.cmu.edu (Jonathan Pace) writes:
>
>   I've fixed my compilation problem (needed MacHeaders) but now I get a fatal
>error.  While running my code, it gets a "bus error" on the line WindowInit()
>below:
>
>main()
>{
>    ToolBoxInit();
>    WindowInit();
>    while ( !Button() );
>}
>
>Suggestions?
>
>Jon Pace

My suggestion is that you have done something wrong in the routine 
ToolBoxInit() but it's impossible to say without having seen that piece of
code.

/Anders

CAH0@bunny.gte.com (Chuck Hoffman) (02/27/91)

I agree with Jon Pardue.  Keep segments under 32K.  Refer to the manual 
for dragging code between segments, or creating new segments.


- Chuck Hoffman, GTE Laboratories, Inc.  |  I'm not sure why we're here,
cah0@bunny.gte.com                       |  but I am sure that while we're
Telephone (U.S.A.) 617-466-2131          |  here, we're supposed to help
GTE VoiceNet: 679-2131                   |  each other.
GTE Telemail: C.HOFFMAN                  |

trotter@ENUXHA.EAS.ASU.EDU (Russell T. Trotter) (02/27/91)

Make sure you are including _ALL_ the necessary toolbox
initialization routines in your Toolboxinit().  This kind
of error often occurs when something is not initialized.
Particularily, check your initgraf()....and other graphic
routines.  Hope that helps!