Sign in to follow this  
CTar

Memory problems

Recommended Posts

Quite a while ago I created a thread because my library was throwing an exception, it threw the exception because I had a STL container which for some reason got created in one DLL and destroyed in another DLL, never really figured out the cause, but two things solved the problem: 1) Changing the runtime (MSVC) to Multithreaded DLL. 2) Making an STL allocator calling Win32 functions instead of std::allocator. Now I'm starting to have some problems with my approach, first if I use my Win32Allocator I can't also supply a specialised allocator. I might be able to do some template stuff to make it possible to specify another allocator, but my biggest problem is one I just discovered. When using other libraries this exception gets thrown aswell (for example in the Loki singleton), I don't know what to do I could edit the Loki source, but that would be a very bad approach for two reasons: 1) This is probably not allowed in the license (I use more than one library so there is a good chance at least one forbid me to change the source). 2) Users would have to replace their Loki (or whatever library I change) implementation with mine. I don't want to force the user to use a specific runtime, but it might be necessary if I find no other alternatives. So have anyone overcome this problem? If so, how?

Share this post


Link to post
Share on other sites
Did you create the DLL files yourself or are they the loki stuff?
If you have created them, maybe you can use a container other than a STL one, like creating your own and modifying it to work within their DLL scopes. I hope this will help.

Share this post


Link to post
Share on other sites
Quote:
Original post by Last Attacker
Did you create the DLL files yourself or are they the loki stuff?
If you have created them, maybe you can use a container other than a STL one, like creating your own and modifying it to work within their DLL scopes. I hope this will help.


If yoy by DLL files mean the files using the Loki library (my game engine), then yes I created them myself. If you mean the Loki DLL then I'm using the static library, but I could re-compile, the problem is that if I change Loki code then I would need all my users to get my custom-Loki code and this is a general problem so it also happens with other libraries, which means that I can't do it since some licenses say I can't edit the source code. Also I don't want to use other containers than the STL ones.

I'm beginning to wonder if I should just change the runtime, what is the difference between the multithreaded runtime and the multithreaded dll runtime?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this