# question about Getpointer of the vktSmartPointer

**URL:** https://discourse.paraview.org/t/question-about-getpointer-of-the-vktsmartpointer/5952
**Category:** In Situ Support
**Tags:** vtk
**Created:** [December 2, 2020, 6:03am UTC](https://discourse.paraview.org/t/question-about-getpointer-of-the-vktsmartpointer/5952 "2020-12-02T06:03:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![zhe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zhe/32/2196_2.png) [@zhe](https://discourse.paraview.org/u/zhe)
#### Post date: [December 2, 2020, 6:03am UTC](https://discourse.paraview.org/t/question-about-getpointer-of-the-vktsmartpointer/5952/1 "2020-12-02T06:03:05Z")

</div>

Hello,

I try to send the vtk object between different services and manage the data object by a particular data structure, but I’m not clear why I can not get the raw pointer and assign it to void\* from the GetPointer operation of the vtkSmartPointer

For this sample code

```auto
      vtkSmartPointer<vtkCharArray> recvbuffer = vtkSmartPointer<vtkCharArray>::New();
      // ... put marshaled data into the recvbuffer
      // ...
      // unmarshal
      vtkSmartPointer<vtkDataObject> recvobj = vtkCommunicator::UnMarshalDataObject(recvbuffer);

      //vtkSmartPointer<vtkDataObject> temp = recvobj; //ok
      //vtkDataObject* temp = recvobj.Get(); //error
      void* temp = (void*)recvobj.GetPointer(); //error

```

I got this error message when the left side is `void* temp` or `vtkDataObject* temp`

```auto
In file included from /global/u2/z/zw241/cworkspace/src/VTK/Common/Core/vtkGenericDataArray.h:73,
                 from /global/u2/z/zw241/cworkspace/src/VTK/Common/Core/vtkAOSDataArrayTemplate.h:36,
                 from /global/u2/z/zw241/cworkspace/src/VTK/Common/Core/vtkCharArray.h:27,
                 from /global/homes/z/zw241/cworkspace/src/Gorilla/server/unimosserver.cpp:29:
/global/u2/z/zw241/cworkspace/src/VTK/Common/Core/vtkSmartPointer.h: In instantiation of 'T* vtkSmartPointer<ArrayType>::GetPointer() const [with T = vtkDataObject]':

/global/homes/z/zw241/cworkspace/src/Gorilla/server/unimosserver.cpp:710:45: required from here
/global/u2/z/zw241/cworkspace/src/VTK/Common/Core/vtkSmartPointer.h:181:43: error: invalid static_cast from type 'vtkObjectBase* const' to type 'vtkDataObject*'
   T* GetPointer() const noexcept { return static_cast<T*>(this->Object); }

```

Thanks a lot for your help!

---

<div class="post-metadata">

### Author: ![zhe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zhe/32/2196_2.png) [@zhe](https://discourse.paraview.org/u/zhe)
#### Post date: [December 1, 2021, 12:38am UTC](https://discourse.paraview.org/t/question-about-getpointer-of-the-vktsmartpointer/5952/2 "2021-12-01T00:38:21Z")

</div>

It looks that we can use this [function](https://vtk.org/doc/nightly/html/classvtkCommunicator.html#a606a9cd2379f4504546e9e9ba0b8f3b6) to marshal the data into a specific type of the data object
