How to write a robot test to check a C-function

In my example I use Visual Code with the plugin PlatformIO and the Robor framework on top of it.

I have written a simple application in which two numbers are added. The function that is used for this is in a separate .c and .h file.

Now to my question:
Is it possible to write a test to call the function to add two numbers and check the returned result ?
I am looking for a way to call specific functions of my C-code and thus check them.

Translated with www.DeepL.com/Translator (free version)

It should be possible.

First, you need to expose your C code into python. Depending on the use-case you could look at 1. Extending Python with C or C++ — Python 3.9.1 documentation or ctypes — A foreign function library for Python — Python 3.9.1 documentation

Once you have python<->c bridge working, then you make a keyword library out of those exposed C functions in python as you would do with any normal python code that you want to access in Robot: Robot Framework User Guide - there might be some additional python code added on top of python → c call for type casting from robot keyword call to suitable ctypes would work…

Thanks for your quick and helpful reply.

@pfox Hallo, are you able to achieve c and py bridge.