[comp.sys.mac.programmer] Think P Segment question

weesh@grymoire.crd.ge.com (Darweesh) (09/17/90)

Well, I'm trying to write a multi-segment program that would use the
Sound Manager heavily if it would stop crashing.  I think that the problem
has something to do with where my callback procedure (for asynchronous sound)
is.  In the sample code supplied by apple (soundapp), they put the callback
procedure in one unit, but put the actual procedure in a certain segment
using {$S main} in MPW (correct me if I get any of this wrong).  Is there any 
way to declare a procedure in a different segment than the rest of a unit in 
Think Pascal? (is there any way to do a {$S main} in think P)

Also, if anyone has any experience in Multi-segment sound manager code in Thinl
Pascal, I woul love to hear from you.

Any help would be greatly appreciated, but please send to the following address
or post c.s.m.programmer if appropriate:

weesh@crd.ge.com

Thanks,
-Mike Darweesh

leonardr@svc.portal.com (09/18/90)

In article <11938@crdgw1.crd.ge.com> weesh@grymoire.crd.ge.com (Darweesh) writes:
>Is there any way to declare a procedure in a different segment than the rest 
>of a unit in Think Pascal? (is there any way to do a {$S main} in think P)
>
	Think Pascal 3.0 supports the {$S <segname>} directives just fine. I
use them in a couple of my own projects as well as playing around with porting
MPW code from work.  It also made the porting of MacApp SO MUCH easier!

Leonard Rosenthol
Software Ventures

phils@chaos.cs.brandeis.edu (Phil Shapiro) (09/18/90)

In article <1990Sep17.171424.18587@svc.portal.com> leonardr@svc.portal.com writes:
   In article <11938@crdgw1.crd.ge.com> weesh@grymoire.crd.ge.com (Darweesh) writes:
   >Is there any way to declare a procedure in a different segment than the rest 
   >of a unit in Think Pascal? (is there any way to do a {$S main} in think P)
   >
	   Think Pascal 3.0 supports the {$S <segname>} directives just fine. I
   use them in a couple of my own projects as well as playing around with porting
   MPW code from work.  It also made the porting of MacApp SO MUCH easier!

   Leonard Rosenthol
   Software Ventures

Heck, it made the porting of MacApp *possible*!  Make sure you disable
the debugger (with {$PUSH} {$D-} <...code...> {$POP}) for your Sound
Manager callbacks.  If an async callback is executed while debugging
is on, Think Pascal will most likely crash.  Of course, you are using
the updated Sound Manager docs (J. Reekes, 1988), not the stuff in
IM-V, right?

	-phil shapiro, symantec tech support
--
Phil Shapiro
phils@chaos.cs.brandeis.edu