473,856 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

boost::intrusiv e_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::intrusiv e_ptr<Unmanaged > pUn = __nogc new Unmanaged();

return 0;
}

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

UnmanagedLib.dl l!_CrtIsValidHe apPointer(...) 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 2301
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_a dd_ref(Unmanage d* pObj);
void intrusive_ptr_r elease(Unmanage d* 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******* *******@cpmsftn gxa06.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
2257
by: BekTek | last post by:
How do you think? and why?
4
2524
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 the functions intrusive_ptr_add_ref and intrusive_ptr_release should do, nor even what their signatures should be. There is one comment that has me a bit unsure about whether my approach is a good one:"On compilers that support argument-dependent...
13
3589
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 exception when you call it with f() saying the function is empty. If you un-comment the #pragma unamanged, it runs fine. It appears to be a code generation problem when compiling function and bind as managed. Thanks Russell
0
1036
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 to do this for __gc classes? I do want to be able to assign the result to a boost::function, but can write my own wrapper if necessary. Thanks
0
1948
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 these DLL interoperate with managed code. Among others things, the managed code need to be able to register for notification with the boost signals. I've tried different approaches (trying to register a pinned delegate with the boost::signal, etc...),
0
870
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, char* panel);
1
5567
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
1051
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 unmanaged code, where as my application itself is managed code. I have a seperae set of unmanaged classes doing the bulk of the work. Now I want to use these classes form the managed class of my application. Let me give a example... Say I have a form and...
1
1946
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 failed: p_ != 0, file .\boost/intrusive_ptr.hpp, line 126" (thread holds NULL pointer to thread function) I've tested this code under gcc 3.4 (mingw32) and gcc 3.2 (linux) - it worked fine in both cases.
0
9920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9764
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11063
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10790
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7932
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7098
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4580
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4176
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.