home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18853 < prev    next >
Encoding:
Text File  |  1992-11-24  |  2.1 KB  |  42 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!spool.mu.edu!darwin.sura.net!news.udel.edu!chopin.udel.edu!kurisuto
  3. From: kurisuto@chopin.udel.edu (Sean J. Crist)
  4. Subject: Opening resource file prevents segments from being loaded
  5. Message-ID: <By7BnK.wv@news.udel.edu>
  6. Sender: usenet@news.udel.edu
  7. Nntp-Posting-Host: chopin.udel.edu
  8. Organization: University of Delaware
  9. Date: Tue, 24 Nov 1992 03:42:54 GMT
  10. Lines: 30
  11.  
  12. This may be a FAQ, but here's what's happening.  My program is divided in
  13. the normal way into CODE segments, including two which I will call segment
  14. A and segment B.  At a point where segment B hasn't yet been loaded into
  15. memory (i.e., I haven't called any procedures in it yet), segment A opens
  16. a resource file.  Then, when a procedure in segment B is called, the
  17. segment loader balks and doesn't load segment B, which of course brings
  18. the program to a speedy crash.
  19.  
  20. By inserting calls in segment A to a do-nothing routine in segment B, I
  21. have narrowed the problem down to the line in my code where I open the
  22. resource file.  If I call segment B before that, segment B loads fine; if
  23. I call segment B even one line after opening the resource file, then
  24. segment B is not loaded.  I don't think the problem is a lack of memory
  25. because I have tried making my heap bigger, which didn't keep this from
  26. happening (and besides, by looking at my heap with a debugger I can see
  27. that there's all kinds of space there for segment B).
  28.  
  29. Of course, the easy way around the problem is to simply load segment B by
  30. calling a do-nothing routine in segment B before opening the resource
  31. file.  This is what I'm currently doing, and it works fine.  But there's
  32. something strange going on here which I don't understand, and you know how
  33. such islands of ignorance can come back and bite you on the nose.  Surely the
  34. segment loader doesn't use the one-deep resource manager calls?
  35.  
  36. (The problem occurs within the run environment in Think Pascal 4.0.  I've
  37. observed it both on an SE and on a IIcx.  I haven't checked to see whether
  38. the problem also occurs in a stand-alone application.)
  39.  
  40. --Kurisuto
  41.  
  42.