annotation Link
Overview
A lib can be marked with @[Link(lib : String, ldflags : String, static : Bool, framework : String)]
to declare the library that should be linked when compiling the program.
At least one of the lib, ldflags, framework arguments needs to be specified.
@[Link(ldflags: "-lpcre")] will pass -lpcre straight to the linker.
@[Link("pcre")] will lookup for a shared library.
- will lookup
pcreusingpkg-config, if not found - will pass
-lpcreto the linker.
@[Link("pcre", static: true)] will favor static libraries over shared libraries.
- will lookup
libpcre.ainCRYSTAL_LIBRARY_PATH, if not found - will lookup
pcreusingpkg-config --static, if not found, - will lookup
libpcre.ain/usr/lib,/usr/local/lib
@[Link(framework: "Cocoa")] will pass -framework Cocoa to the linker.
When an -l option is passed to the linker, it will lookup the libraries in
paths passed with the -L option. CRYSTAL_LIBRARY_PATH, /usr/lib,
and /usr/local/lib are added by default. Custom paths can be passed
using ldflags: @[Link(ldflags: "-Lvendor/bin")].