linker - Linking a shared object into other shared object C++ project -


i working in big c++ project create big shared object using external sdk have several header files , several shared libraries belong each other. means declaration of sdk classes in header files definitions in shared objects.

i understand because of declarations in header files can compile code.

but not understand when have specify used shared objects linker explicitly?

namely if specify (e.g. in cmake target_link_libraries command) linker can check symbol in shared library or not. happens if not specify (i.e. there not -l[shared_object_name] flags in linkage)? experience (which surprised me) work (i.e. whole building process finished). how can possible?

in posix shared libraries, can have undefined symbols in shared library, , link fine. long executable linked, there no linker errors.

that's done way because dynamic libraries mimic behaviour of static libraries, , static libraries can have undefined symbols (static libraries not linked, begin with).

if come windows background, surprise you, because windows dlls cannot have undefined symbols.

if worried this, can check linker options --no-undefined , --no-allow-shlib-undefined.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -