473,657 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Managed extensions" pinning question

Consider the code:
wchar_t __pin *p= &(someComman d->ToCharArray( ))[0];

_wsystem(p);

p=0;


I need to pin the wchar_t __gc [] because I need to pass it to
_wsystem() which takes a wchar_t *.
Does the above code pin the whole wchar_t __gc[]?


--
Ioannis Vranos
Nov 17 '05 #1
7 1315
Ioannis,
Consider the code:
wchar_t __pin *p= &(someComman d->ToCharArray( ))[0];

_wsystem(p);

p=0;

I need to pin the wchar_t __gc [] because I need to pass it to
_wsystem() which takes a wchar_t *.
Does the above code pin the whole wchar_t __gc[]?


Yep. From the MC++ spec, section 7.7 "Pinning Pointers":

"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 array, declare a pinning pointer to its
element type, and pin one of its elements.".

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
Tomas Restrepo (MVP) wrote:
Yep. From the MC++ spec, section 7.7 "Pinning Pointers":

"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 array, declare a pinning pointer to its
element type, and pin one of its elements.".

OK thanks. Where can I find that spec?


--
Ioannis Vranos
Nov 17 '05 #3
Ioannis Vranos wrote:
Tomas Restrepo (MVP) wrote:
Yep. From the MC++ spec, section 7.7 "Pinning Pointers":

"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
array, declare a pinning pointer to its element type, and pin one of
its elements.".

OK thanks. Where can I find that spec?


It's in the /vc7 directory of a Visual Studio .NET 2002/3 installation -
ManagedExtensio nsSpec.doc

-cd
Nov 17 '05 #4
Carl Daniel [VC++ MVP] wrote:
It's in the /vc7 directory of a Visual Studio .NET 2002/3 installation -
ManagedExtensio nsSpec.doc

OK thanks.

--
Ioannis Vranos
Nov 17 '05 #5
On a side note, it's not a very good idea to invest time on the old syntax.
You should try and move to the new C++/CLI syntax.

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
"Ioannis Vranos" <iv*@remove.thi s.grad.com> wrote in message
news:O6******** ******@TK2MSFTN GP14.phx.gbl...
Consider the code:
wchar_t __pin *p= &(someComman d->ToCharArray( ))[0];

_wsystem(p);

p=0;


I need to pin the wchar_t __gc [] because I need to pass it to
_wsystem() which takes a wchar_t *.
Does the above code pin the whole wchar_t __gc[]?


--
Ioannis Vranos

Nov 17 '05 #6
Nishant S wrote:
On a side note, it's not a very good idea to invest time on the old
syntax. You should try and move to the new C++/CLI syntax.


Unless you plan to ship something in the next 9 months that is.

-cd
Nov 17 '05 #7
Yep, good point :-)

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:e6******** ******@TK2MSFTN GP10.phx.gbl...
Nishant S wrote:
On a side note, it's not a very good idea to invest time on the old
syntax. You should try and move to the new C++/CLI syntax.


Unless you plan to ship something in the next 9 months that is.

-cd

Nov 17 '05 #8

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

Similar topics

1
1439
by: tom | last post by:
I wanna start a project and be sure I have c++ managed code. But as I'm creating classes and stuff, I see "unmanaged" in the properties. How can I get off to a better start here ? thanks, tom
0
963
by: James Thompson | last post by:
I have the book "Microsoft Visual C++ .NET Step by Step" for Visual Studio .NET 2002. Well, I am currently using Visual Studio .NET 2003. In chapter 2 of this book, it tell me to create a new Visual C++ project and under templates choose "Managed C++ Application". In 2003, there is no "Managed C++ Application". What is 2003's equivalent to this? Thanks for the help. (why do they have to change these things?)
1
2670
by: Robert A Riedel | last post by:
I am completely baffled when the following managed exception is thrown: "Object reference not set to an instance of an object" from a nested subroutine when referencing a variable allocated on the program stack. Given the following simple example: void T( System::String * S ) { const wchar_t __pin * pchars PtrToStringChars( S ) ;
5
2182
by: Nick | last post by:
Hi there, I despearately need to get IIS working with ASP.NET, but I still can't see any "Web Service Extensions". My previous question regarding this ended in the decision to uninstall .NET Framework 1.1 then reinstall, unfortunately this seems to have done nothing. I've tried calling aspnet_regiis in a number of ways but that seems to do nothing either, even though it says that uninstallation and installation completes...
12
1285
by: Antonio Policelli | last post by:
hello, this is to be a loaded question!! i do not really know what "managed code" means. can somebody explain it to me? AP
5
2302
by: SunnyDrake | last post by:
HI! I wrting some program part of it is XML config parser which contains some commands(for flexibility of engenie). how do i more simple(if it possible not via System.Reflection or System.CodeDom.CodeCastExpression) __problem typecast #1 Desc:i do needed checks but data/commands in XML is dynamic and i don't wanna fix C# code again and again... Sample:foreach (object some in somearray) (some.GetType())some.someaction();
0
1019
by: widmerd | last post by:
Would anyone have the code to replace the name in the "managed by field" of a computer object with another name. Thanks
2
1854
by: Andy Dingley | last post by:
http://bingweb.binghamton.edu/~tony/cake.jpg From: http://community.livejournal.com/good_eats/507059.html
11
1735
by: Jon Mcleod | last post by:
I'm trying to wrap my ming around C#/CLR garbage collection. In an ASP.NET project, I'm having a problem because an object destructor is being called by another thread, long after my code is done. I'm wanting to know if I can force it to happen immediately (when the object goes out of scope) without going back and adding all of the required Dispose() calls.. public Method() { CustomClass o = new CustomClass(..);
0
8407
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
8319
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
8739
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
8512
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
5638
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();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
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
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.