Hi
i m having a few problems while writing a wrapper to a unmanaged dll .
I have an unmanaged class that si devired from unmanaged dll interface so i cant declare it as a gc class.
While writing definitions i want to use .net framework classes say
System::Threading::Thread . My problem is i cant pass a non gc class
into threadstart method.
Whats the possible solution . Is there any way to convert a non gc
class to a gc class so that i can use it with Framework classes .
Please have a look at what i m really facing in the code below.
.
Test.h File:
class UnamangedClass : public UnmanagedDLLInterface
{
public:
UnmanagedClass();
virtual void method1() ; //From UnmanagedDLLInterface//
void method2(); //Class own method
}
Test.cpp File:
void
UnmanagedClass::method1()
{
System.Threading.ThreadStart *threadStarter = new ThreadStart(this,UnmanagedClass::method2)
// Actually its not allowing me this coz it accepts _gc Class in the first arg//
System.Thread.Thread *thread = new Thead(threadStarted);
thread->Start();
}
void
UnmanagedClass::method2()
{
//Any thing to do here//
}
Any idea will be highly appreciated .
Thanks in advance
Tabish

Problems While Wrapping Unmanaged DLL to Managed DLL
cave_troll
Well the problem was easily sorted out myself
I used gcroot template (System::Runtime::INterop) and was able to run the thread from managed side that peroform the underlying functionalit provided in Unmanaged class.
Following changed were made in the code:
Test.h File:
class UnamangedClass : public UnmanagedDLLInterface
{
public:
gcroot<ThreadStart*> threadStart;
gcroot<ThreadStart*> threadt;
UnmanagedClass();
virtual void method1() ; //From UnmanagedDLLInterface//
void method2(); //Class own method
}
//Added this class
__gc class MangedClass
{
UnmanagedClass *uClass;
void UnmanagedThreadCall();
}
Test.cpp File:
void
UnmanagedClass::method1()
{
System.Threading.ThreadStart *threadStarter = new ThreadStart(this,UnmanagedClass::method2)
// Actually its not allowing me this coz it accepts _gc Class in the first arg//
System.Thread.Thread *thread = new Thead(threadStarted);
thread->Start();
}
void
UnmanagedClass::method2()
{
//Any thing to do here//
}
void ManagedThreadCall()
{
//Create the ThreadObject here and Run the Unamanaged Class method from here
}
Thanks....