|
-
February 1st, 2010, 03:57 PM
#1
passing __gc form to __nogc object
Hello,
I've got the following problem.
In my application i would like to pass an __gc form to an __nogc class. Like this.
public: __gc MyForm() {
public: Myclass * MyObject;
....... Load Of my form ......
MyObject = new Myclass( this);
};
Unfortunatly, with visual c++ .NET, it's impossible!
Any sugection?
Tank in advance for help.
-
February 2nd, 2010, 03:40 AM
#2
Re: passing __gc form to __nogc object
In C++/CLI there is gcroot keyword, but I don't know whether is is supported in managed C++.
-
February 2nd, 2010, 04:08 AM
#3
Re: passing __gc form to __nogc object
It should working, but i don't know where place it in my code
-
February 2nd, 2010, 06:35 AM
#4
Re: passing __gc form to __nogc object
Add class member of type gcroot<MyForm*> to Myclass and try to initialize it with MyForm reference, using constructor parameter or directly.
-
February 2nd, 2010, 07:42 AM
#5
Re: passing __gc form to __nogc object
Once declare as following, how could I use the form.
public MyClass {
Myclass();
gcroot<MyForm*> f;
}
-
February 2nd, 2010, 07:47 AM
#6
Re: passing __gc form to __nogc object
....... Load Of my form ......
MyObject = new Myclass();
MyObject->f = this;
-
February 2nd, 2010, 08:00 AM
#7
Re: passing __gc form to __nogc object
I've got the following error :
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'MyAppli::MyForm __gc *const ' (or there is no acceptable conversion)
-
February 2nd, 2010, 08:08 AM
#8
Re: passing __gc form to __nogc object
This is compiled in C++/CLI 2005:
Code:
ref class RefClass;
class NativeClass
{
public:
NativeClass(){}
gcroot<RefClass^> m_pRefClass;
};
ref class RefClass
{
public:
RefClass()
{
pNativeClass = new NativeClass();
pNativeClass->m_pRefClass = this;
}
NativeClass* pNativeClass;
};
Look at gcroot definition of your C++ version.
-
February 2nd, 2010, 09:37 AM
#9
Re: passing __gc form to __nogc object
I do not finc the solution, do you have any idea to resolve my problem.
Do you think the reason of the problem is the Refclass is a Form?
Last edited by jeffouille; February 2nd, 2010 at 10:20 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|