MLLIF
a MLIR-based Language to Language Interoperability Flyover
|
We will create sample C++ project whose symbols are gonna be extracted:
To use MLLIF in your CMake project, You can include MLLIF's CMake toolkit:
Then, You can use add_mllif_library
as below:
As you see, MLLIF project can be established with tree arguments: target name, language id, source files:
Also, you can modify compile-options or output directory, etc...
target_compile_options...
or CMAKE_CXX_STANDARD
things! It's because add_mllif_library
is implemented with add_custom_target
. If you know how to interoperates them, Please make Pull Request!!!We will use sample C++ code as below:
[[mllif::export]]
attribute represents that marked symbol will be exported. And, if the attribute annotates record-type (class, struct), All public method of type will be exported.
So, This code and the code described before make same result:
You can get symbols and bridge simply. Just build project target in CMake. Then, You can get symbol-model file(*.msm) and a dynamic library (bridge).
You can use this MSM file to create wrapper for a bridge with backend system. For details, See backend tutorial with your favourite language!