I'm trying to figure out how using [Library] for [type] is compiled by the solc compiler. I noticed that address placeholders are not in the bytecode as with other library references. So what exactly does the compiler do here?

I understand from the documentation, that it 'attaches' the functions to a type, but does that mean it takes the relevant library code and adds it to the compiled bytecode?

  • 1
    I believe it depends on the functions in the library. Pure functions are just inlined (so yes, included with your compiled bytecode).
    – user19510
    Jan 11, 2019 at 21:39
  • That's an interesting question. When debugging in Remix the Set.Data example from solidity.readthedocs.io/en/v0.5.2/contracts.html#using-for there is a DELEGATECALL to the library for the insert function. What I didn't get yet: at which point is he deploying and linking the library contract? In the init code of C?
    – ivicaa
    Jan 12, 2019 at 6:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.