Hi! I want to use boost's shared_ptr in my project, which is a dll. At the moment it looks like this: in the h: extern MY_API CCPUDetect * gCPU; in the cpp: CCPUDetect * gCPU = CCPUDetect::GetInstance(); I have problems to make the same with boost, so that gCPU is a smartpointer. Thanks, Christian Gmeiner [Non-text portions of this message have been removed]
Christian Gmeiner wrote:
Hi!
I want to use boost's shared_ptr in my project, which is a dll. At the moment it looks like this:
in the h: extern MY_API CCPUDetect * gCPU;
extern boost::shared_ptr<CCPUDetect> gCPU;
in the cpp: CCPUDetect * gCPU = CCPUDetect::GetInstance();
boost::shared_ptr<CCPUDetect> gCPU(CCPUDetect::GetInstance()); I assume that CCPUDetect::GetInstance() returns a dynamically allocated raw pointer to CCPUDetect. If not, then you shouldn't be using a smart pointer construct such as boost::shared_ptr<>.
participants (2)
-
Christian Gmeiner
-
Edward Diener