home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / os2 / programm / 7443 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  1.9 KB

  1. Path: sparky!uunet!usc!news.service.uci.edu!beckman.com!rariedel
  2. From: rariedel@beckman.com (Bob Riedel)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: **SEGMENT VIOLATIONS and DLLs**
  5. Message-ID: <1993Jan8.171124.1078@beckman.com>
  6. Date: 8 Jan 93 17:11:24 PDT
  7. Organization: BECKMAN
  8. Lines: 39
  9.  
  10. I am having difficulty getting an application object library to work
  11. without generating segment violation errors under OS/2 V1.3 using the
  12. Microsoft C6 compiler.
  13.  
  14. The modules which make up the library are being compiled using the
  15. /MT /AL /Aw /G2 /Gc switches because they are ultimately destined to be
  16. part of a DLL (they are not currently).
  17.  
  18. I am having some difficulty deciding when to use the _loadds attribute
  19. on the individual functions, and the absence of this attribute on some
  20. of the components of the library seems to be the primary cause of the
  21. problem.
  22.  
  23. All of the problems (so far) appear when one module passes stack variables
  24. by reference to another module. For some reason the receiving module cannot
  25. reference the caller's data. It even happens when private modules (those not
  26. referenced outside the DLL) in a separate thread wake up on a timer and pass
  27. stack variables by reference to another function (which then blows up). The
  28. offending private modules have static data.
  29.  
  30. These are my questions:
  31.  
  32.     1 - When do you use the _loadds attribute, and when do you not
  33.         have to?
  34.  
  35.     2 - Can the private parts of the library, that is those functions
  36.         which cannot be called outside the library, be compiled using
  37.         a standard model (ie: /MT /AL), while only the exported sections
  38.         are compiled using /ALw?
  39.  
  40.     3 - If the answer to (2) is no, then does that mean that even some
  41.          private modules must have the _loadds attribute?
  42.  
  43.     4 - Does the main() need any special attributes if it is compiled
  44.         using /ALw?
  45.  
  46.     5 - Why can't the Microsoft C "Advanced" Programming Techniques
  47.         manual answer some of these stupid questions?
  48.         
  49.