MyObj* myObj = NULL; long CreateObj(){ myObj = new MyObj(); return (long)myObj; } ... void getObj(long p){ MyObj* pObj = (MyObj*)p; }