Is it safe to use STL (TR1) shared_ptr's between modules (exes and dlls)

后端 未结 5 1621
借酒劲吻你
借酒劲吻你 2020-12-28 19:14

I know that new-ing something in one module and delete-ing it in another can often cause problems in VC++. Problems with different runtimes. Mixing modules with staticly lin

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-28 20:02

    I'd guess it is as safe as to use any of the classes in std across modules.

    That is: It should be safe if the modules use exactly the same runtime library, and exactly the same compiler switches and options.

    Never use the static runtime library, as each module will get their own instance of all globals within it.

提交回复
热议问题