titzer / virgil

A fast and lightweight native programming language
1.22k stars 42 forks source link

interop with C? #61

Closed wenq1 closed 2 years ago

wenq1 commented 2 years ago

How is interop with C supposed to work? with FFI or clang preprocessing?

titzer commented 2 years ago

When compiling to Wasm, you can specify imports by having an import component that has methods. The resulting Wasm module can be linked against functions written in any language, including C.

Unfortunately there isn't a solution yet for writing Virgil code that can interoperate with C on any of the native targets.