HMIProject / open62541-sys

1 stars 2 forks source link

Library Naming #22

Closed guenhter closed 1 week ago

guenhter commented 1 week ago

Hi,

I'm doing some things nowadays with C wrapper libraries, and as far as I understood the way of how the naming somehow "evolved" around this matter (without Rust officially defining any convention about this):

Maybe at this point you don't agree with my investigation. If so, please share your thoughts.

When I used this library (open62541-sys) I wondered for a while where the prebuild sources should come from until i realized, that this is actually a sort of "open62541-src" lib, which compiles the code actually.

Do you think it is worth renaming this lib to avoid confusion?

sgoll commented 1 week ago

I'm not sure if the distinction between *-sys and *-src is common practice. I realize that openssl-src and luau0-src use this to split bundled source code into another crate (which is then used by the corresponding *-sys crate), as well as several crates related to BLAS/LAPACK. Other than that, I'm not aware of too many crates that do this (creates.io has some crates published by Maroon502 but that seems to be it).

On the other hand, paho-mqtt-sys and sdl2-sys, for example, both ship with bundled source code.[^1]

[^1]: The latter has a corresponding *-src crate but it's empty and not used.

I mean, we could split the code into a separate open62541-src crate instead of bundling it into the open62541-sys crate. I'm just not sure if the result is worth the effort.

What would be the advantage of keeping the source code in a separate crate? Do you have examples of *-src crates and maybe know what their motivation for the split was?

guenhter commented 1 week ago

Maybe I'm just deas wrong and got a wrong impression.

I don't think there is an advantage if there is no inofficial convention.

guenhter commented 4 hours ago

@sgoll I stumbled over this today https://doc.rust-lang.org/cargo/reference/build-scripts.html#-sys-packages