First of all, thank you Nebuchadnezzar for your help with my previous question. I got the Win32 Sys Prog 2nd book, and now have made the shared memory "volatile" and have create an event with the waitforsingleobject to control the thread. It works well.
I am having a new problem now. I want to create a DLL that has several common functions that DX programs will use. I added a function to it to load an Xfile, extract the textures and materials, add normals to the mesh, and optimize it.
My game runs fine until I exit. Then during the cleanup phase it bombs with an exception when it tries to delete the first class object that contains the first mesh. I traced it through the destructors. But it bombs in the dbgheap.c:
Display All
If I put the exact same code in a function, instead of the DLL, I get no errors. So, it is only with the DLL function call that I get the problem.
What would be unique with the DLL memory management that could cause this? It seems to be a heap issue. I tried allocating memory for some strings with "new" instead of just as static in size, but no difference.
Oh, and I don't get any problems with the small test program I wrote to test/debug the DLL code. I only get it when I use the DLL in my game.
The second thread is not started until after the DLL has been used to create the meshes for the game.
Thanks.
I am having a new problem now. I want to create a DLL that has several common functions that DX programs will use. I added a function to it to load an Xfile, extract the textures and materials, add normals to the mesh, and optimize it.
My game runs fine until I exit. Then during the cleanup phase it bombs with an exception when it tries to delete the first class object that contains the first mesh. I traced it through the destructors. But it bombs in the dbgheap.c:
Source Code
- #else /* WINHEAP */
- /*
- * 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.
- *
- */
- for (i = 0; (base = _heap_regions[i]._regbase) != NULL &&
- i < _HEAP_REGIONMAX; i++)
- {
- if (pUserData >= base && pUserData <
- (void *)(((char *)base)+_heap_regions[i]._currsize))
- return TRUE;
- }
- return FALSE;
- #endif /* WINHEAP */
- --> } (THE GREEN POINTER IS HERE)
If I put the exact same code in a function, instead of the DLL, I get no errors. So, it is only with the DLL function call that I get the problem.
What would be unique with the DLL memory management that could cause this? It seems to be a heap issue. I tried allocating memory for some strings with "new" instead of just as static in size, but no difference.
Oh, and I don't get any problems with the small test program I wrote to test/debug the DLL code. I only get it when I use the DLL in my game.
The second thread is not started until after the DLL has been used to create the meshes for the game.
Thanks.