🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #6843

Mixed Memory Model Libraries

#6843
From: Mike Peterson
Date: Tue, 28 May 1991 18:47
49 lines
2408 bytes
    While I'm using Turbo C V2.0, I suspect that this question is applicable to
    users of MSC as well.  So, here goes.

    I want to build a large memory model library against which small model
    applications may link.  My question is around the multiple modules that
    comprise the library.  For example,  the library FOO.LIB is built from the
    following source modules:

    		foo.c	Contains the public API routines, the prototypes 
    			for which are in foo.h and are included by the 
    			user's application.  Compiled with the -ml switch.

    		bar.c	Private to the LIB.  Routines in foo.c call
    			routines in utils.c

    		misc.c	Private to the LIB.  Routines in foo.c and bar.c 
    			call routines in misc.c.

    			Both bar.c and misc.c have services which call one or
    			more of the public functions in foo.c
    			
    I want the routines in bar.c and misc.c to be NEAR with respect to
    foo.c and each other (Apart from those internal routines that call
    public services).

    Here's what I think I should do.  I'm hoping someone will tell me if I'm
    wrong or if there are gotchas that I've not taken into consideration:

    	1) Prototype all of the public library services with the FAR keyword
    	   in, say public.h.  Public.h, may then be included in the user's 
    	   application.  Now, all calls to the FOO.LIB routines become FAR 
    	   calls.

    	2) Compile foo.c with the -ml switch and the other modules with the
    	   default (-ms) switch.  The compiler will make all calls to bar.c
    	   routines and misc.c routines NEAR calls.  All calls from routines
    	   in bar.c or misc.c to routines in foo.c will be FAR calls.


    Regards,

    /mtp

--
#
#      +--------------------------------------------------------------+
#      | Michael T. Peterson          | mtp@mold.enet.dec.com         |
#      | Digital Equipment Corp.      | ...!decwrl!mold.enet!mtp      |
Technical Details
Message-ID: <1521@rust.zso.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!pa.dec.com!rust.zso.dec.com!mold.zso.dec.com!mtp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!pa.dec.com!rust.zso.dec.com!mold.zso.dec.com!mtp
From: mtp@mold.zso.dec.com (Mike Peterson)
Newsgroups: comp.os.msdos.programmer
Subject: Mixed Memory Model Libraries
Message-ID: <1521@rust.zso.dec.com>
Date: 28 May 91 18:47:42 GMT
Sender: news@rust.zso.dec.com
Organization: Digital Equipment Corporation, Bellevue Wa
Lines: 49