rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Support exporting a C header from a PLC Interface

Open ghaith opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. When writing external Libraries in different languages, we have to write the interfaces by hand. It would be good if we could simply generate the given C header file for a given PLC project.

Describe the solution you'd like Using a new command like plc generate ffi -o header.h we could generate headers for the project. The command will generate a C header in header.h. If no output is provided, it will be output on stdout.

The documentation should be updated to reflect how to create external libraries. We should define a C standard for the definition, and use appropriate data types.
I suggest we use the fixed size integer types from C99 defined in stdint.h The double_t and float_t types from math.h The char8_t and char16_t from wchar.h (C11) for CHAR and STRING types.

Describe alternatives you've considered Writing headers by hand.

ghaith avatar Apr 17 '24 12:04 ghaith

Would love to have this for integration with other projects. I have a simple generator that takes the ir output. Unfortunately the names are omitted at this stage. Ideally this would hook into a stage before the llvm input.

ysmilda avatar Sep 11 '24 11:09 ysmilda