Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!milton!sumax!polari!rwing!seaeast!sunbrk!Usenet From: Mike.Peterson@sunbrk.FidoNet.Org (Mike Peterson) Newsgroups: comp.os.msdos.programmer Subject: Mixed Memory Model Libraries Message-ID: <675518012.69@sunbrk.FidoNet> Date: 28 May 91 23:47:42 GMT Sender: Usenet@sunbrk.FidoNet.Org Lines: 52 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 | * Origin: Seaeast - Fidonet<->Usenet Gateway - sunbrk (1:343/15.0)