# How to implement a custom reader plugin in C++?

**URL:** https://discourse.paraview.org/t/how-to-implement-a-custom-reader-plugin-in-c/17196
**Category:** Development
**Created:** [September 22, 2025, 2:29pm UTC](https://discourse.paraview.org/t/how-to-implement-a-custom-reader-plugin-in-c/17196 "2025-09-22T14:29:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![CsatiZoltan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/csatizoltan/32/6997_2.png) [@CsatiZoltan](https://discourse.paraview.org/u/CsatiZoltan)
#### Post date: [September 22, 2025, 2:29pm UTC](https://discourse.paraview.org/t/how-to-implement-a-custom-reader-plugin-in-c/17196/1 "2025-09-22T14:29:01Z")

</div>

Hi,

So far, I managed to set up the build system for my ParaView plugin. The plugin compiles and I can load it in ParaView. When I try to open a file with .meshb extension, for which I develop this plugin, ParaView quits with the following message:  
_vtkSIProxy.cxx:402 ERR| vtkSISourceProxy (0x3dd25350): Failed to create ‘gmfReader’. This typically means that ParaView does not know about the request class to create an instance of if. Ensure that it has been correctly wrapped using the client-server wrappers and the wrapping has been initialized. Note class names are case-sensitive. Check for typos. Aborting for debugging purposes._

Currently, my custom reader contains no relevant code because first I wanted to understand how the plugin structure works. Could you help me writing a minimal header and source file, or pointing me to an existing MWE, that does not make ParaView segfault? I already looked at a lot of examples, but:

- either the example wraps an existing reader (e.g. _MyPNGReader_ example), so there is no C++ code that implements the reader
- or it is part of a complex project (e.g. LidarView), from which I do not understand what is strictly necessary on the C++ side to implement a custom reader. For instance, how does ParaView know which method of my C++ reader class to call when I open a .meshb file in the GUI?

As I would like to read a file into a `vtkUnstructuredGrid` object and wrap it in a ParaView plugin, it makes me think that I should subclass `vtkUnstructuredGridAlgorithm`. Am I right?

I can share my plugin file, my module file, my XML file, etc. if you need further input.

Thank you

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 22, 2025, 3:59pm UTC](https://discourse.paraview.org/t/how-to-implement-a-custom-reader-plugin-in-c/17196/2 "2025-09-22T15:59:06Z")

</div>

> [@CsatiZoltan](#):
>
> Failed to create ‘gmfReader’.

This is the typical error when the client server wrapping failed to generate, you need to check the generated files.

> For instance, how does ParaView know which method of my C++ reader class to call when I open a .meshb file in the GUI?

The XML file contains all that info

> it makes me think that I should subclass vtkUnstructuredGridAlgorithm

You can, but there are dedicated reader class you can inherit to avoid boiler plate code

> Could you help me writing a minimal header and source file, or pointing me to an existing MWE, that does not make ParaView segfault?

`RegistrationName` example plugin does more than that but it does declare a C++ class which is a reader.

---

<div class="post-metadata">

### Author: ![CsatiZoltan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/csatizoltan/32/6997_2.png) [@CsatiZoltan](https://discourse.paraview.org/u/CsatiZoltan)
#### Post date: [September 22, 2025, 4:30pm UTC](https://discourse.paraview.org/t/how-to-implement-a-custom-reader-plugin-in-c/17196/3 "2025-09-22T16:30:56Z")

</div>

> you need to check the generated files

Many directories and files are generated. Which files should I check? Is it documented somewhere? The problem is that I didn’t find documentation about the generated files (e.g what is the trailing “CS” in the file names?) and the structure of `ServerManagerConfiguration` in the XML file. Currently, I try to find something similar in _Remoting/Application/Resources/_ to start with, but in case of an error I have no idea what goes wrong.

> but there are dedicated reader class you can inherit to avoid boiler plate code

Which class is it, the `vtkDataReader`? I want modularity in the sense that my VTK module can read our mesh format (i.e. create a `vtkUnstructuredGrid` object) without any knowledge of ParaView. Then the ParaView plugin is a lightweight wrapper around it. I think I am on the good track:

1. `vtk_module_scan` and `vtk_module_build` to build the shared library
2. I defined a CMake option, `GMFREADER_BUILD_PV_PLUGIN`. When `ON`, I call `paraview_plugin_scan` and `paraview_plugin_build` on the VTK module I built in step 1.

Both steps work, now I have to

- implement the actual logic of reading our mesh format
- write the client-server wrapping in the XML file

> `RegistrationName` example plugin

It subclasses `vtkPNGReader`. For my use case, which base class would you choose? I looked at the class diagram of `vtkUnstructuredGridAlgorithm.html` and saw that several file readers (GAMBIT, Nektar5000, Chaco, etc.) subclass it, that’s why I thought about it. But you said it has boilerplate…

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 24, 2025, 8:45am UTC](https://discourse.paraview.org/t/how-to-implement-a-custom-reader-plugin-in-c/17196/4 "2025-09-24T08:45:35Z")

</div>

> Many directories and files are generated. Which files should I check?

[build\_dir]/[PluginName]/CMakeFiles/[vtkModuleName]CS/[vtkFilterName]ClientServer.cxx

> Which class is it, the vtkDataReader?

Nevermind, in your case vtkUnstructuredGridAlgorithm makes sense.
