Hello!
can anybody helpme to resolve this, i tried to parse this c# code to c, but i failed.
public static int VarPtr(object e)
{
GCHandle GC = GCHandle.Alloc(e, GCHandleType.Pinned);
int gc = GC.AddrOfPinnedObject().ToInt32();
GC.Free();
return gc;
}
what exactly do these,and how i can write in c.
sorry, my english is bad.
Loading

theLizardRank #1,079 · 1.8K reputationPosted Jul 24, 2010, 8:31 PM EDT
You cannot convert this code to C.
Sam HobbsRank #107 · 20.5K reputationPosted Jul 25, 2010, 12:25 PM EDT
Are you totally sure you must convert to C? If it is possible to use C++, then that will be easier. Objects are by definition classes and C does not have classes but you can use COM objects in C but it requires more typing and such. I am not sure, but I assume you cannot use .Net in C.
Javier Flores3 reputationPosted Jul 26, 2010, 6:25 AM EDT
Ok i understood but this is the problem, for example, i use the VarPtr function and i convert the address to int32 and i if i have:
COPYDATASTRUCT data;
LONG_PTR valor=(LPARAM) (LPVOID) &data;
"valor" may content the equivalent ?
thanks.
Sam HobbsRank #107 · 20.5K reputationPosted Jul 26, 2010, 7:02 AM EDT