By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,738 Members | 1,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,738 IT Pros & Developers. It's quick & easy.

"Managed extensions" pinning question

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.