473,785 Members | 2,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pinning problem

Hi all,

i've just encountered a problem with pinning. it seems as if a managed object is moved altough a pinning pointer to this object is still alive

code snippet:

ManagedObject __pin* pManagedObject = &this->managedObjec t;

/*lots of unmanaged memory allocation*/

//here pManagedObject contains lots of garbage
UnmanagedRoutin e(pManagedObjec t);

//this solves the problem, but the pointer value is different to pManagedObject!
ManagedObject __pin* pNewPinningPtr = &this->managedObjec t;
UnmanagedRoutin g(pNewPinningPt r);

any idea why this can happen?

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>EIrcWZO37Eq fPK9DbYlKGA==</Id>
Nov 17 '05 #1
0 980

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1438
by: Chris Finlayson | last post by:
Hello: I have a question on pinning types via 'fixed'. In "Com and .NET interoperability" by Andrew Troelsen, he provides a simple example of ..NET -> Native interoperability: int theVals={1,2,3,4}; MyCustomDLLWrapper.AddArray(theVals,theVals.Length) where MyCustomDLLWrapper wraps a native (C++) .dll:
3
1543
by: J | last post by:
I understand how to pin pointers as they are declared, but for some reason, I can'f figure out the syntax for predaclaring a pointer and then pinning in afterward like you would if you wanted to embed an unmanaged object: Assumingthat pAudioU has alread been defined as the appriate type of pointer, Instead of pAudioU = new __pin AudioDriver_U; // syntax error it seems necessary to take the extra step of creating an intermediate
1
1657
by: demofo | last post by:
Does the pinning pointer safe?since the Read function will change the ppBuffer points to unmanaged C++ heap,how does the dot net runtime knows they will not move the allocated memory (pointed by ppBuffer)during the garbage collection? class NonGCClass { private: int GetBufferLength() {
7
1321
by: Ioannis Vranos | last post by:
Consider the code: wchar_t __pin *p= &(someCommand->ToCharArray()); _wsystem(p); p=0;
9
1542
by: Brian Victor | last post by:
I have a situation where I have a vector<gcroot<ManagedWrapperClass*> > whose contents I need to pass to an unmanaged function. Is there a way to pin all the pointers in the vector for that function? I tried to copy the vector into another vector with a pinned pointer type, but the compiler will not allow __pin to be used in a template parameter. Thanks! -- Brian
3
2216
by: Hexar Anderson | last post by:
I have two questions: a) From documentation located at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcManagedExtensionsSpec_7_7.asp, it says, "Pinning a sub-object defined in a managed object has the effect of pinning the entire object. For example, if any element of an array is pinned, then the whole array is also pinned. There are no extensions to the language for declaring a pinned array. To pin an...
5
3418
by: Maxwell | last post by:
Hello, Newbie question here. I have a VS.NET 2003 MC++ (not C++/cli) project where I have a managed class reference in a unmanaged class...simple enough. To keep things short I am for the most part attempting to do what is this article by Nish: http://www.voidnish.com/articles/ShowArticle.aspx?code=cbwijw I have to hook up a unmanaged callback to a managed method using IJW NOT P\Invoke. So I am employing this "Thunk" or "Bridge" class...
2
7909
by: steve | last post by:
Hi all, I want to understand more about how the pinvoke pinning process works. I'm writing some code that calls DeviceIoControl. DeviceIoControl provides a generic interface to device drivers. Its signature is deliberately open-ended so that it can be highly generic. Refer SDK for more. I want to access the drive geommetry of an SD-Card via
12
12557
by: DaTurk | last post by:
Hi, I have a rather interesting problem. I have a unmanged c++ class which needs to communicate information to managed c++ via callbacks, with a layer of c# on top of the managed c++ ultimatley retreiving the data. Presently all of the c++ code is still in .NET 1.1, so we're using a _nogc bridge class wrapped in a _gc c++ class in order to facilitate this interop. But we've converted everything not c++ to .NET 2.0 and would love to
0
9645
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
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
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
9949
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
7499
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
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
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
3645
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.