Newbyte
Newbyte

Reputation: 3252

How do I compile Rust code without linking, i.e. produce object files?

Due to how the LGPL works, compiling Rust code to an object file without linking would be useful to be able to do. However, I cannot find any documentation on how to do this. I checked rustc's help section and searched, but couldn't find anything, which brings me to my question: How do I tell rustc to not link and produce object files that later can be linked?

Upvotes: 6

Views: 6287

Answers (1)

E_net4
E_net4

Reputation: 29983

Use the compiler flag --emit=obj.

cargo rustc -- --emit=obj

The compiled object files will be sitting in target/debug/deps.

See also:

Upvotes: 7

Related Questions