Is it OK to use boost::shared ptr in DLL interface?

前端 未结 5 536
臣服心动
臣服心动 2021-01-04 19:21

Is it valid to develop a DLL in C++ that returns boost shared pointers and uses them as parameters?

So, is it ok to export functions like this?

1.) b         


        
5条回答
  •  时光说笑
    2021-01-04 19:56

    DLLs do not normally own resources - the resources are owned by the processes that use the DLL. You are probably better off returning a plain pointer, which you then store in a shared pointer on the calling side. But without more info it's hard to be 100% certain about this.

提交回复
热议问题