# Foreign Function Interface Generation for Dart/Flutter - ffigen

**URL:** <https://discourse.vtk.org/t/foreign-function-interface-generation-for-dart-flutter-ffigen/10160>\
**Category:** Development\
**Created:** [December 11, 2022, 2:49pm UTC](https://discourse.vtk.org/t/foreign-function-interface-generation-for-dart-flutter-ffigen/10160 "2022-12-11T14:49:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![giiyms](https://discourse.vtk.org/user_avatar/discourse.vtk.org/giiyms/32/6243_2.png) [@giiyms](https://discourse.vtk.org/u/giiyms)\
**Post date:** [December 11, 2022, 2:49pm UTC](https://discourse.vtk.org/t/foreign-function-interface-generation-for-dart-flutter-ffigen/10160/1 "2022-12-11T14:49:12Z")

</div>

Hello,

I would like to attempt converting the VTK headers so Flutter/Dart can talk to it directly.

Does anyone know / can point me to the core/barebones headers needed for VTK to work?

If anyone is interested in helping, there is a new tool for Flutter/Dart called ffigen to automatically create the interfaces.  
[https://pub.dev/packages/ffigen](https://pub.dev/packages/ffigen)

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)\
**Post date:** [December 11, 2022, 4:18pm UTC](https://discourse.vtk.org/t/foreign-function-interface-generation-for-dart-flutter-ffigen/10160/2 "2022-12-11T16:18:00Z")

</div>

I see that `ffigen` only supports C headers, so VTK’s very C++ headers are not of much use here AFAICT. There is the `Wrapping/Tools` set of APIs that can parse VTK’s headers. Writing a tool to generate Dart/Flutter glue code like we do for Python and Java would probably be the best way to do this.

---

<div class="post-metadata">

**Author:** ![giiyms](https://discourse.vtk.org/user_avatar/discourse.vtk.org/giiyms/32/6243_2.png) [@giiyms](https://discourse.vtk.org/u/giiyms)\
**Post date:** [December 12, 2022, 10:35am UTC](https://discourse.vtk.org/t/foreign-function-interface-generation-for-dart-flutter-ffigen/10160/3 "2022-12-12T10:35:21Z")

</div>

Okay thank you, appreciate your input. I will look into it.

---

<div class="post-metadata">

**Author:** ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)\
**Post date:** [December 12, 2022, 1:48pm UTC](https://discourse.vtk.org/t/foreign-function-interface-generation-for-dart-flutter-ffigen/10160/4 "2022-12-12T13:48:45Z")

</div>

If you’re interested, I have a project called WrapVTK ([https://github.com/dgobbi/WrapVTK](https://github.com/dgobbi/WrapVTK)) for parsing the VTK header files and extracting information from them. It’s built on top of VTK’s own wrapping infrastructure.
