473,386 Members | 1,694 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,386 software developers and data experts.

"Managed extensions" pinning question

Consider the code:
wchar_t __pin *p= &(someCommand->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 1294
Ioannis,
Consider the code:
wchar_t __pin *p= &(someCommand->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 -
ManagedExtensionsSpec.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 -
ManagedExtensionsSpec.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.this.grad.com> wrote in message
news:O6**************@TK2MSFTNGP14.phx.gbl...
Consider the code:
wchar_t __pin *p= &(someCommand->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.nospam >
wrote in message news:e6**************@TK2MSFTNGP10.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
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
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...
1
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...
5
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...
12
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
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...
0
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
by: Andy Dingley | last post by:
http://bingweb.binghamton.edu/~tony/cake.jpg From: http://community.livejournal.com/good_eats/507059.html
11
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....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
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...

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.