What's the [link(name="")] for?

This is a directive that tells the compiler that the code is going to link to a library called whatever is inside the quotes. You don't need the likes of mathlib.dll,  mathlib.so, or  mathlib.a inside the quotes, just the name without the extension.

There are three different types of link (called models and defined in the kind parameter following the name) available: dynamic, static, and framework (though the latter is for macOS only). The following table gives a summary of what they are for. For the majority of the time, the dynamic type is used.

Type

Example

Notes

Dynamic

[link(name="foo")]

This is the default. The compiled binary creates hooks that will link into the platform installed form of the library.

Static

[link(name="foo", kind="static")]

These are .a files. When the application is built, the binary is created, but the platform library file is not required to be distributed.

Framework

[link(name="foo", kind="framework")]

macOS only. This will be the .dylib file and is treated the same as a dynamic library.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset