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
Sam HobbsPosted Jul 26, 2010, 11:02 AM
Javier FloresPosted Jul 26, 2010, 10:25 AM
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 HobbsPosted Jul 25, 2010, 4:25 PM
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.
theLizardPosted Jul 25, 2010, 12:31 AM
You cannot convert this code to C.