Skip to content

Why not a Guide for building PLC libraries in Rust? #1227

Answered by ghaith
TheColonel2688 asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@TheColonel2688
Comment options

@ghaith
Comment options

Answer selected by TheColonel2688
@TheColonel2688
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants