Newsgroups: comp.windows.ms.programmer
Path: funic!news.funet.fi!sunic!psinntp!psinntp!rpi!batcomputer!caen!uwm.edu!psuvax1!uxa.ecn.bgu.edu!news.ils.nwu.edu!news.acns.nwu.edu!andersen!halabe
From: halabe@andersen.uucp (Dan Halabe)
Subject: Rookie Mistake?  "Not enough mem..."
Message-ID: <halabe.722101152@andersen>
Summary: Generic App Calling DLL-Intermitent low mem message
Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
Organization: Northwestern University, Evanston, Illinois, USA
Date: Wed, 18 Nov 1992 15:39:12 GMT
Lines: 27

Its been a little while since I've programmed under windows - maybe someone
out there can catch what I figure is a  rookie error.

I've taken some very simple ANSI C and turned it into a dll by:
1) Making the public functions FAR PASCAL calls
2) Building it with large model (using pwb to set all the switches for dlls)
3) Exporting the public calls in the .def file

Then I've taken the generic sample app that comes with the sdk, and called my
dll.  The calling code allocates a couple of char arrays on the stack and
calls the two exported functions.  No explicit alloc or deallocs in either
module.  The generic program .def file imports the exported functions from the
dll.

All this compiles and links fine (with only a few warnings about old style
declarations in the generic app).  It runs perfectly the first time. When I
try to load it a second time I get a message box saying "Insufficient memory
to run this application.  Quit one or more...".  The third time works
perfectly, and the forth gives me the same error.  As far as I can tell,
every even attempt works, and every odd one fails.  What gives?

I'd appreciate any help I can get.  I forgot how much stuff you have to know
*besides* the language and the api.

Thanks
Dan Halabe
halabe@andersen.com 
