Why not a Guide for building PLC libraries in Rust? #1227
Answered
by
ghaith
TheColonel2688
asked this question in
Q&A
-
Dumb question. Why not build a guide for building PLC Libraries in Rust, instead of C? |
Beta Was this translation helpful? Give feedback.
Answered by
ghaith
Sep 5, 2024
Replies: 1 comment 3 replies
-
Not dumb at all. It is required for our Internal documentation at work where C/C++ Api already exists and needs to be wrapped to work in PLC. But I would like to extend it do the same in rust. We are after all also using Rust for the Standard libs. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rust mangles the function names by default, it requires re-writing the mangler/demangler in the compiler to produce rust code. we chose to follow the C convention of not mangling the names, this way they can be called by other languages without much trouble. This allows us to implement libraries or interface with libraries in any language.
This is also what rust does when it needs to interface with the outside world: https://doc.rust-lang.org/nomicon/ffi.html
Implementing only a rust calling convention would have locked us into rust as the only interface language or led us to write wrappers for other languages.