473,378 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

boost::intrusive_ptr and Managed C++?

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
3 2268
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: BekTek | last post by:
How do you think? and why?
4
by: Steven T. Hatton | last post by:
I'm trying to create an baseclass that will serve as a parent for reference counted objects handled by boost::intrusive_ptr<>. The documentation didn't provide much in the way of describing what...
13
by: Russell Hind | last post by:
I'm trying to use boost::bind and boost::function inside managed code, but there appears to be some code generation problems. The following code compiles fine, but the function object throws an...
0
by: Russell Hind | last post by:
Is it possible to create a boost::bind object for a managed class method? With non-managed classes, I can do boost::function<void ()> f = boost::bind(&Class_c::Function, this); Is there a way...
0
by: Arnaud Debaene | last post by:
Hello all. I've got a bunch of existing, non managed, C++ DLLs that export types with, among other things, public events implemented using the boost::signals library. Now, I need to have...
0
by: hcg-bear | last post by:
I am trying to invoke a c++ dll from mixed (managed/unmanaged) c++. My class layout is: __nogc class ManagedHmsImpl { public: static void hmsLogon(int hmsRole, int hcpPrimary, char* post,...
1
by: Noah Roberts | last post by:
Trying to use boost::function in a C++/CLI program. Here is code: pragma once #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace System;
2
by: querry | last post by:
Hi all, I am developing a Windows Form Application in VC++. I am using using Visual Studio 2005. My project requires me to use the Boost Libraries www.boost.org] These boost libraries are...
1
by: Boogie | last post by:
Hi, A specific problem arises when I try to use boost::thread 1.35.0 with Borland Turbo 2006. Code below compiles but when run it throws (in commented line - thread creation): "assertion...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.