Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!samsung!uunet!world!goodearl From: goodearl@world.std.com (Robert Goodearl) Newsgroups: comp.windows.ms.programmer Subject: Re: Memory models Message-ID: <1990Nov27.221632.1106@world.std.com> Date: 27 Nov 90 22:16:32 GMT References: <2365.27537b67@waikato.ac.nz> Organization: The World @ Software Tool & Die Lines: 26 In article <2365.27537b67@waikato.ac.nz> iam@waikato.ac.nz (Ian McDonald) writes: >I am having fun at the moment with memory models. > >At the moment I am using code like : > read(hFile,lpMsgBuffer,size); > >and compiling in large model. I would prefer to have it compiled under small >or medium model as that gives moveable data segments. If I do though it can't >seem to reference lpMsgBuffer which is a far pointer to a buffer The solution for this particular problem is to use the windows function _lread which takes an LPSTR for the buffer parameter. Read chapter 14 of the Guide to Programming. pp 14-8 lists a number of functions that take LPSTR parameter. Section 14.5.4 talks about file io using _lopen, _lcreate, _lread and _lwrite. You should be aware that you don't use the standard C libraries (or .h files) when compiling for windows 3.0 with C 6.0. All the .h files and .lib files needed are provided with the SDK. Also, be sure to define _WINDOWS at the top of your source file or on the command line for the compiler when compiling for a windows executable. When compiling for a DLL, define BOTH _WINDOWS and _WINDLL. -- Bob Goodearl -- goodearl@world.std.com