Sign in to follow this  
edwinnie

DLL, functor, singleton, heap combo

Recommended Posts

ok i was playing with some code. i could get DLLs to work, functors to do callbacks, and singletons to work too. I am using Loki library. I noticed that there is a sort of local heap memory for the DLL, such that the singleton being accessed on the main project is not the same as that in the DLL. Come to think of it, having such a need to access functions from the main project in the DLL might not justify the usage of the DLL though. so i tried functors for calling back some functions provided by a singleton in the main project. It does help by doing the processing in the main heap. But it does seem silly though. so i wondering how u pple manage singletons across DLLs, considering that there are different heaps. thx! Edwinz

Share this post


Link to post
Share on other sites
Uhh, I might be wrong, not having dabbled much into DLLs, but if you exported a function which returned a reference to the static singleton object in your DLL, wouldn't that do just fine?

Share this post


Link to post
Share on other sites
well,if we put singletons to exist in the dll alone,then it wouldnt be a singleton in the main project, meaning we possibly cannot extract the pointer, (which is provided by the dll across the interface function), globally in the main project.

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