By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,700 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

boost::intrusive_ptr and Managed C++?

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/showf...?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.
Nov 16 '05 #2

P: n/a
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

ti******@online.microsoft.com (Tian Min Huang) wrote in message news:<le**************@cpmsftngxa06.phx.gbl>...
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/showf...?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.

Nov 16 '05 #3

P: n/a
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.
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.