lib3mf provides two ways to integrate the C++ bindings into your host application. Both are header-only, making them easy to include in existing projects.
Implicit Loading (Load-time)
Use this method if you want the operating system to handle loading the library when your application starts. You must ensure the shared library file (lib3mf.*) is in a path searched by your OS (e.g., LD_LIBRARY_PATH on Linux, or the application directory on Windows).
- Header to include:
Cpp/lib3mf_implicit.hpp - Usage: Call
CWrapper::loadLibrary() to get a wrapper object.
Dynamic Loading (Run-time)
Use this method if you want to explicitly specify the location of the shared library file at runtime.
- Header to include:
CppDynamic/lib3mf_dynamic.hpp - Usage: Call
Lib3MF::CWrapper::loadLibrary("path/to/lib3mf") with the explicit path to the library file.
// Implicit loading example
Lib3MF::PWrapper wrapper = CWrapper::loadLibrary();
// Dynamic loading example (OS specific paths)
// Linux:
Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary("LibraryLocation/lib3mf.so");
// Mac OSX:
Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary("LibraryLocation/lib3mf.dylib");
// Windows:
Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary("LibraryLocation/lib3mf.dll");