kevin@msa3b.UUCP (Kevin P. Kleinfelter) (05/16/91)
I'm trying to create some C++ class libraries for use in my Windows programming (who isn't!) I'd like to put my class libraries in a DLL. This sounds nice, except that the constructor allocats the storage for the class. If the constructor is in the DLL, then the memory allocated comes from the DLL's near heap -- if I have lots of applications using my DLL, I could run out of near heap. What have I got wrong? Is it unreasonable to put C++ class libraries in a DLL? (I sure do hate having duplicate code loaded with multiple applications.) -- Kevin Kleinfelter @ DBS, Inc (404) 239-2347 ...gatech!nanoVX!msa3b!kevin English Lesson: THEY'RE at THEIR home, over THERE. YOU'RE sure of YOUR facts? "Its" & "their" are like 'his'. "They're" == "they are." "It's" == "it is." If you can do regular expressions, you can handle a natural language. Syntax!
davidds@microsoft.UUCP (David D'SOUZA) (05/23/91)
In article <1647@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >I'd like to put my class libraries in a DLL. This sounds nice, except >that the constructor allocats the storage for the class. If the >constructor is in the DLL, then the memory allocated comes from >the DLL's near heap -- if I have lots of applications using my DLL, >I could run out of near heap. My guess is, Windows will probably run out of system resources before you run out of heap space for your DLL and its clients. You could also be smart about using global memory for storing large data ex. contents of your own listbox class could be stored in global memory. This may help you get away with just using the local heap. Another idea is to use global memory for multiple instances of a class. For example, all type foo controls (no matter what the app) are stored as an array in one global alloced block. All type bar controls (no matter what the app) are stored in another global alloced block. Finally, another thing is to assume apps that call you are ds==ss. You could simply switch onto the app's ds (getting it from ss), do the LocalAllocs etc, and then switch back when you need your own ds. You then have to make sure the window extra words contain the proper stuff to retrive this data again... -Dave