-
Notifications
You must be signed in to change notification settings - Fork 15
Static Shared Embedding
Statically linking to a shared library is a good choice for projects who don't want to depend on an installed version of the runtime, but have multiple binaries who all depend on the runtime. The process of statically linking to a shared library is highly platform dependent, due to the different ways that Linux and Windows resolve dynamic loading.
Note that, despite this being a static link to a shared library, you will still have access to the Static Functions outlined in the External API.
Dynamic Library:
innative.dllandinnative-d.dllDebug Information:
innative.pdbandinnative-d.pdbStatic Link Library:
innative.libandinnative-d.libDefault Environment:
innative-env.libandinnative-env-d.lib
Add the static library (innative.lib) to your project's Additional Dependencies (for Visual Studio) or your build system's equivalent. Then, place the dynamic library (innative.dll), it's debug information (innative.pdb) and the default environment (innative-env.lib) inside your /bin/ directory, and ensure you distribute them with your application.
If you are building a DLL, consider statically embedding the runtime instead, because anyone using your DLL will also have to include innative.dll and the default environment, which could quickly turn into DLL Hell
Shared Library:
libinnative.soDefault Environment:
innative-env.aandinnative-env-d.a
Add the shared library to your linker step using linnative. Then, place the shared library (libinnative.so) and the default environment (innative-env.a) inside your /bin/ directory, and ensure you distribute them with your application.
Important: If you do not include libinnative.so next to your executable, and the user has another version of the runtime installed, Linux will automatically link to that version instead, even if it's incompatible. To avoid this, you can rename your version of the runtime to libinnative.0.1.0.so and link to it via -linnative.0.1.0. Then, even if you don't include the runtime, linux will always link to the correct version, if it exists.
You can also link to a different semantic version of the library by using -linnative.0.1, which will link to any v0.1.x version of the library, or -linnative.0, which links to any v0.x.x version. You can use this method to statically link to an installed version of the runtime on linux, instead of using the Dynamic Shared Embedding method.