I wrote a program that makes use of a class which stores objects. When it runs out of room it allocates (using "new") a new, larger area, copies the objects over, and then deletes (using "delete") the old space. It works great, and is much used in the code. The class is in a staticly loaded library.
More lately I need to create a DLL to do certain functionality. It is called by the application, and it also makes use of the class (again, statically loaded into the DLL). There seems to be no problem with being able to access any object in the class storage from either the app or the dll (I could be wrong about this; I've not tested it exhaustively); however, when the dll tries to place an object into storage and it has to re-allocate, the delete fails. The place where it fails at in the CRT library source is "_CrtIsValidHeapPointer", and has a comment:
Can someone direct me to somewhere where I can read about this? what the rules are? or is there a way to configure the compiler to handle this, perhaps? I've done an hour's worth of looking (here and in Google) and cannot find anything that describes what I'm seeing (or, rather, that I recognize as describing...).
I'm using the MS .NET compiler, with platform SDK only (no MFC, ATL, managed, .NET or what have you).
More lately I need to create a DLL to do certain functionality. It is called by the application, and it also makes use of the class (again, statically loaded into the DLL). There seems to be no problem with being able to access any object in the class storage from either the app or the dll (I could be wrong about this; I've not tested it exhaustively); however, when the dll tries to place an object into storage and it has to re-allocate, the delete fails. The place where it fails at in the CRT library source is "_CrtIsValidHeapPointer", and has a comment:
Code:
* Go through the heap regions and see if the pointer lies within one
* of the regions of the local heap.
* Pointers from non-local heaps cannot be handled. For example, a
* non-local pointer may come from a DLL that has the CRT linked-in.
Can someone direct me to somewhere where I can read about this? what the rules are? or is there a way to configure the compiler to handle this, perhaps? I've done an hour's worth of looking (here and in Google) and cannot find anything that describes what I'm seeing (or, rather, that I recognize as describing...).
I'm using the MS .NET compiler, with platform SDK only (no MFC, ATL, managed, .NET or what have you).