🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #3388

**SEGMENT VIOLATIONS and DLLs**

#3388
From: Bob Riedel
Date: Sat, 09 Jan 1993 00:11
39 lines
2001 bytes
I am having difficulty getting an application object library to work
without generating segment violation errors under OS/2 V1.3 using the
Microsoft C6 compiler.

The modules which make up the library are being compiled using the
/MT /AL /Aw /G2 /Gc switches because they are ultimately destined to be
part of a DLL (they are not currently).

I am having some difficulty deciding when to use the _loadds attribute
on the individual functions, and the absence of this attribute on some
of the components of the library seems to be the primary cause of the
problem.

All of the problems (so far) appear when one module passes stack variables
by reference to another module. For some reason the receiving module cannot
reference the caller's data. It even happens when private modules (those not
referenced outside the DLL) in a separate thread wake up on a timer and pass
stack variables by reference to another function (which then blows up). The
offending private modules have static data.

These are my questions:

	1 - When do you use the _loadds attribute, and when do you not
	    have to?

	2 - Can the private parts of the library, that is those functions
	    which cannot be called outside the library, be compiled using
	    a standard model (ie: /MT /AL), while only the exported sections
	    are compiled using /ALw?

	3 - If the answer to (2) is no, then does that mean that even some
 	    private modules must have the _loadds attribute?

	4 - Does the main() need any special attributes if it is compiled
	    using /ALw?

	5 - Why can't the Microsoft C "Advanced" Programming Techniques
	    manual answer some of these stupid questions?
        
Technical Details
Message-ID: <1993Jan8.171124.1078@beckman.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!beckman.com!rariedel

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!beckman.com!rariedel
From: rariedel@beckman.com (Bob Riedel)
Newsgroups: comp.os.os2.programmer
Subject: **SEGMENT VIOLATIONS and DLLs**
Message-ID: <1993Jan8.171124.1078@beckman.com>
Date: 8 Jan 93 17:11:24 PDT
Organization: BECKMAN
Lines: 39