Standard libraries

How is that I can use functions or objects from Arduino standard libraries like digitalWrite() or Serial without including them? Are all standard libraries somehow included implicitly?

I think they are part of a larger library that main() calls, so they get included for us.
Search main.h, Arduino.h in your Arduino folder to see what's in them.

You may have to dig down several layers to see them called out.

The ide injects a main.cpp file before compiling into the sketch. This file includes Arduino.h that brings all the common functions

The common functions are then called from other files.
HardwareSerial.h seems to where Serial comes from for example.

#if defined(UBRRH) || defined(UBRR0H)
  extern HardwareSerial Serial;
  #define HAVE_HWSERIAL0
#endif

Yes, HardwareSerial.h is included by Arduino.h

michalt38:
How is that I can use functions or objects from Arduino standard libraries like digitalWrite() or Serial without including them? Are all standard libraries somehow included implicitly?

Part of turning your .ino file into a .cpp file to pass to the compiler is inserting "#include <Arduino.h>" at the top. That defines all the Arduino functions.

Libraries are written as .cpp files so if they want to use any Arduino functions they have to include Arduino.h explicitly.

All IDE magic. Turn on the "verbose" option for compiler in the Preferences pane, and you'll be able to see it all happen.

So basically the ino file is converted to normal cpp file and then passed to compiler? Is the conversion done by IDE or some specific tool?

the IDE does mess around with all the files from your sketch - basically merge them all, add the main.cpp I mentioned above, look for includes to find the relevant libraries and then launch a compile / link process

As @westfw said, if you change your preference to 'verbose compilation', you can see that a temp folder is created and all your stuff copied there and that's where the compilation happens