Correction: Is it possible to declare a static managed member in UNMANAGED
code?
> Is it possible to declare a static managed member in managed code?
>
[quoted text clipped - 4 lines]
>
> Any suggestions?
Gary Chang[MSFT] - 02 Mar 2005 07:40 GMT
Hi Klynt,
>Correction: Is it possible to declare a static managed member in
>UNMANAGED code?
AFAIK, the gcroot is used to wrapped an managed object in a unmanaged
object(class), but the code of gcroot<...> declaration should be compiled
as managed code, for the gcroot copy constructor needs to create a new GC
handle and use managed types and call managed functions.
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ??C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Gary Chang[MSFT] - 04 Mar 2005 08:58 GMT
By the way, do you mean is it possible to declare a static managed member
in UNMANAGED object(class) and instance it
like the following code snippet:
class UnManagedClass {
public:
CppClass() {}
static gcroot<String*> str;
};
..
UnManagedClass::str = new String("Hello");
Then I think you will get the LNK2020 : unresolved token error while
compiling the above code, if you still monitor this thread and have concern
on the problem, please reply this message and I will contact the
corresponding support specialist for you.
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ??C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.