Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Should we clarify when library code is linked vs embedded? #3985
To my surprise, I get nice, fully-linked, deployable code if I compile this.
That surprised me (pleasantly), because the imported parent contract (indirectly) depends on Zeppelin's SafeMath library. I expected the code to include
I'm happy, it works, yay! But in the documentation, I can't find an explanation of when the compiler would expect to link to a library, and when it would just embed library functionality into the generated code. Pretty much all of the discussion of libraries presumes they would be separately deployed and linked.
I'd be glad to try to update the docs, if I understood the rules for when library functionality is inlined-vs-linked myself. But I don't. Can anyone help?
p.s. I am using my own tooling, rather than
That seems like a good thing to document very clearly. (It seems like a very useful trick, to get the code reuse without the complexity of an extra module and a linkage and post-hack nervousness over the security of
I see in the docs an example of a library built with
Now that I know what I am looking for, I see that this behavior is more explicitly documented here
Still, having read that page before and not understood the implication (that no separate library would need to be deployed if only
Anyway, thank you again for resolving the mystery.