Click to See Complete Forum and Search --> : ^ <--what is this?


RingPack
March 31st, 2008, 12:24 AM
array<String^>
System::Collections::IEnumerator^


I wanted to use .net class in visual c++ project.
I followed some instructions and changed options when I compile my project.
But, above code generates errors.
What is ^ sign?
Why do I need?
If that sign is necessary, how can I go away errors?

If that is not possible, I have to learn c# from the scratch, because I have used vc++ and c++ only so far.

allow
March 31st, 2008, 10:26 AM
'^' designates a .NET handle, which is parallel to an unmanaged pointer ('*').

A handle is a managed pointer, whose address points to an object on the managed heap, and is updated automatically by the CLR as it moves the object's location.

Please be more specific as to what exactly you try to do, and what the error is.

CBasicNet
April 1st, 2008, 02:57 AM
Try enclosing them with

#pragma managed(push, on)
void func2() {
array<String^>
System::Collections::IEnumerator^
....
}
#pragma managed(pop)

darwen
April 1st, 2008, 05:06 PM
I wouldn't just mix .NET and native C++ code together if you don't know what you're doing.

Just use one or the other if you're learning.

Darwen.