home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17540 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.3 KB  |  45 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!netnews!bandy
  3. From: bandy@netnews.jhuapl.edu (Mike Bandy)
  4. Subject: Re: Does opening libraries require a fixed varname?
  5. Message-ID: <BzGwBB.JBC@netnews.jhuapl.edu>
  6. Organization: JHU/Applied Physics Laboratory
  7. References: <BzDnFz.FM5@usenet.ucs.indiana.edu>
  8. Date: Fri, 18 Dec 1992 18:21:10 GMT
  9. Lines: 34
  10.  
  11. shulick@navajo.ucs.indiana.edu (Sam Hulick) writes:
  12.  
  13.  
  14. >If I wanted, for instance, to open intuition.library, does the line
  15. >*HAVE* to be:
  16.  
  17. >IntuitionBase = OpenLibr.......
  18.  
  19. >Can it be something like "IBase = OpenLibrary(.." or "blech = Open..."
  20. >In other words, does it matter what you call the variable?
  21. >GadToolsBase, ExecBase, GfxBase, etc.
  22.  
  23. Yes it matters.  Name is *exactly* like you see it described in the texts.
  24.  
  25. I tried the following - it took me several hours to figure out why my
  26. A3000 kept crashing!
  27.  
  28. LONG init()
  29. {
  30. static APTR IntuitionBase;        /* *** WRONG *** */
  31.    IntuitionBase = OpenLibr....
  32. }
  33.  
  34. The return value is important and must be stored in a *global* variable
  35. for reference by the stubs (see other replies for a description of the
  36. AmigaDOS library mechanism).  No compile or run time error message results
  37. in calling a routine with an unitialized or undefined base variable - your
  38. Amiga just crashes.
  39.  
  40. -- 
  41.  
  42.     Mike Bandy
  43.     bandy@aplcomm.jhuapl.edu
  44.     Johns Hopkins University / Applied Physics Lab
  45.