Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["cdylib", "rlib"]
crate-type = ["rlib"]

[features]
default = ["borsh"]
Expand Down
15 changes: 10 additions & 5 deletions program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,21 @@
//!
//! ```toml
//! [lib]
//! crate-type = ["cdylib", "rlib"]
//! crate-type = ["cdylib"]
//!
//! [features]
//! no-entrypoint = []
//! ```
//!
//! Note that a Solana program must specify its crate-type as "cdylib", and
//! "cdylib" crates will automatically be discovered and built by the `cargo
//! build-bpf` command. Solana programs also often have crate-type "rlib" so
//! they can be linked to other Rust crates.
//! Note that a Solana program must specify its crate-type as "cdylib", to
//! be discovered and built by the `cargo-build-sbf` command as a deployable program.
//! Solana programs also often have crate-type "rlib" so they can be linked to other Rust crates.
//! Avoid using "rlib" and "cdylib" crates together, since their combined usage precludes
//! compiler optimizations that may decrease program size and CU usage.
//!
//! Prefer writing a separate package if it is supposed to be used as a library for other Solana
//! programs (i.e. a "rlib" only crate). When created a Rust project intended to be a program
//! ready for deployment, ues only the "cdylib" crate type.
//!
//! # On-chain vs. off-chain compilation targets
//!
Expand Down
2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["cdylib", "rlib"]
crate-type = ["rlib"]

[lints]
workspace = true
Loading