Q
quortex
Hi all,
I have a native class which has a single instance controlled via the
singleton pattern. I need to call this from both native C++ and from
mixed mode visual studio 2005 c++ CLI.
At the moment I have a MC++ unit test project which accesses the
singleton. What I seem to be finding is that the singleton accessed
directly from the unit test project is not the same instance as the
singleton accessed from native code.
And this is within the same session I am accessing the singleton from
the managed c++ CLI unit test project but when the same project calls a
native class which accesses the singleton it is a different instance.
When calling from the same locations as a test the singleton works
perfectly.
I understand that in a mixed environment there is the garbage collected
managed heap and the native heap however when accessing native types
from either I would expect them to be in the same memory space?
I am very confused here surely I should be accessing the same singleton
instance?
Kind Regards,
Mark
I have a native class which has a single instance controlled via the
singleton pattern. I need to call this from both native C++ and from
mixed mode visual studio 2005 c++ CLI.
At the moment I have a MC++ unit test project which accesses the
singleton. What I seem to be finding is that the singleton accessed
directly from the unit test project is not the same instance as the
singleton accessed from native code.
And this is within the same session I am accessing the singleton from
the managed c++ CLI unit test project but when the same project calls a
native class which accesses the singleton it is a different instance.
When calling from the same locations as a test the singleton works
perfectly.
I understand that in a mixed environment there is the garbage collected
managed heap and the native heap however when accessing native types
from either I would expect them to be in the same memory space?
I am very confused here surely I should be accessing the same singleton
instance?
Kind Regards,
Mark