boost::intrusive_ptr and Managed C++?

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

Has anyone used boost's intrusive_ptr with Managed C++ extensions?

I have a small project where the executable (managed) is linked to a
native C++ dll.

The code looks like:

int _tmain()
{
boost::intrusive_ptr<Unmanaged> pUn = __nogc new Unmanaged();

return 0;
}

when I exit out of main, boost::intrusive_ptr_release() throws an
exception. The last known method called is:

UnmanagedLib.dll!_CrtIsValidHeapPointer(...) Line 1807

but when I replace my code with:

Unmanaged* pUm = new Unmanaged();
delete pUm;

no exception is thrown.

Please help!

-Drew
 
Hello Drew,

Thanks for your post. I did some research on my side, however, I did not
find any known issue. What's the version of Boost C++ Libraries you are
using? You can download the latest at
http://sourceforge.net/project/showfiles.php?group_id=7586.

In the meantime, since you are using third-party C++ library, I recommend
you contact Boost Mailing Lists at
http://www.boost.org/more/mailing_lists.htm to check this issue.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
I am using 1.30.0. I'll try with 1.30.2.

Has anyone tried this? I've narrowed down the problem a little more.

I have two global functions that get called when the intrusive_ptr is
created/destroyed.

namespace boost
{
void intrusive_ptr_add_ref(Unmanaged* pObj);
void intrusive_ptr_release(Unmanaged* pObj);
}

If these functions are exported from my unmanaged DLL, it causes the
problem below. If these functions are in my managed DLL, everything
works fine.

Does this help anyone narrow down what's going on?

Thanks,
Drew
 
Hello Drew,

As you know, Boose is third-party C++ libarry, I believe that you may be
best served by contacting Boost directly.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
Back
Top