[comp.sys.mac.programmer] Help Me Call Code Resources From My DA...

sonenbli@oxy.edu (Andrew D. Sonenblick) (09/30/89)

      I already spoke to Tom about this one...

      I am writing a DA which opens ResFiles in the System Folder,
      loads standalone code from each one--and for now LOCKS the
      Handles to the code resources--(of course then closing the
      ResFiles).  During this I store the Handles in an array of
      Handles.	The DA then calls each resource with a init
      message (same as CDEV, etc.)  They all execute and return
      properly.  (Note that all of this occurs in the "case Open"
      in my DA)

      Then, however, during the "caseControl" when I call the
      (locked) resources with the same parameters, same Handles, etc
      Macsbug kicks in with an ILGL err.  I know the blocks are not
      being moved around, so my handles *should* be valid.  Is there
      a problem with the fact that my DA's code is possibly being
      moved around?  What else may be causing this problem?  I need
      suggestions as I have a time limit on this project!  Please,
      help out a fellow "struggling programmer" (anologous to the
      "starving artist")--if you have any suggestions, small or large,
      simply reply to me as soon as possible.  I promise I will
      somehow return the favor.  Thank you very much.

      Ando Sonenblick.	Address: sonenbli@oxy.edu
--------------------------------------------------------------------------------
The ultimate question isn't: "Why are we alive?" or "Why is the universe
in existence?" or  "Why are somethings unknowable?"  Instead, it is:
			 "Why do I ask why?" (Think about it...)
--------------------------------------------------------------------------------

han@Apple.COM (Byron Han) (10/01/89)

In article <50798@tiger.oxy.edu> sonenbli@oxy.edu (Andrew D. Sonenblick) writes:
>      I am writing a DA which opens ResFiles in the System Folder,
>      loads standalone code from each one--and for now LOCKS the
>      Handles to the code resources--(of course then closing the
>      ResFiles).  

Did you detach the resource handles?  If not, then the resources go away
when you close the resource file that the resource comes from.

>      During this I store the Handles in an array of
>      Handles.	The DA then calls each resource with a init
>      message (same as CDEV, etc.)  They all execute and return
>      properly.  (Note that all of this occurs in the "case Open"
>      in my DA)
>
>      Then, however, during the "caseControl" when I call the
>      (locked) resources with the same parameters, same Handles, etc
>      Macsbug kicks in with an ILGL err.  

At this point, your handles may be pointing to garbage if you did not
explicitly detach the code resources.