Skip to content

About

πŸŒ‹ Almagamated library of mulle-atexit + friends

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

84 Commits

Folders and files

Repository files navigation

mulle-core-all-load

πŸ›Έ mulle-core-all-load does something

Force-linkable amalgamated library for mulle-core initialization libraries

Release Version Release Notes AI Documentation
Mulle kybernetiK tag Build Status RELEASENOTES DeepWiki for mulle-core-all-load

Documentation & Guides

You are here

Overview

Add

There are various methods how to get mulle-core-all-load into your project. One common denominator is that you will #include <mulle-core-all-load/mulle-core-all-load.h> in your sources and link with -lmulle-core-all-load.

Add as a dependency with mulle-sde

Use mulle-sde to add mulle-core-all-load to your project:

mulle-sde add github:mulle-core/mulle-core-all-load

This library does not include mulle-atinit and mulle-atexit and mulle-testallocator. If you add these libraries, it is important that mulle-core is added before them.

To only add the sources of mulle-core-all-load with dependency sources use clib:

Add sources to your project with clib

clib install --out src/mulle-core mulle-core/mulle-core-all-load

Add -isystem src/mulle-core to your CFLAGS and compile all the sources that were downloaded with your project. (In cmake add include_directories( BEFORE SYSTEM src/mulle-core) to your CMakeLists.txt file).

Add as subproject with cmake

mulle-core is not bundled with mulle-core-all-load. Add both with FetchContent:

include( FetchContent)

set( MULLE__CORE_TAG "master" CACHE STRING "branch or tag to fetch mulle-core from")

FetchContent_Declare( MULLE__CORE
   GIT_REPOSITORY https://github.com/mulle-core/mulle-core.git
   GIT_TAG        "${MULLE__CORE_TAG}")
FetchContent_MakeAvailable( MULLE__CORE)

set( MULLE__CORE__ALL__LOAD_TAG "master" CACHE STRING "branch or tag to fetch mulle-core-all-load from")

FetchContent_Declare( MULLE__CORE__ALL__LOAD
   GIT_REPOSITORY https://github.com/mulle-core/mulle-core-all-load.git
   GIT_TAG        "${MULLE__CORE__ALL__LOAD_TAG}")
FetchContent_MakeAvailable( MULLE__CORE__ALL__LOAD)

target_link_libraries( ${PROJECT_NAME} PRIVATE mulle-core-all-load)

FetchContent_MakeAvailable( MULLE__CORE) must come before FetchContent_MakeAvailable( MULLE__CORE__ALL__LOAD), because mulle-core-all-load depends on the mulle-core target and its headers.

mulle-core-all-load is a force-linkable initialization library: it registers atinit/atexit callbacks that must end up in your binary even if no symbol of the library is referenced directly. The target created by FetchContent_MakeAvailable carries the necessary INTERFACE force-link options, so the target_link_libraries( ${PROJECT_NAME} PRIVATE mulle-core-all-load) above is sufficient. When linking mulle-core-all-load as an installed static library instead, force-link it explicitly:

# Linux (GCC/Clang)
-Wl,--whole-archive -lmulle-core-all-load -Wl,--no-whole-archive

# macOS
-force_load libmulle-core-all-load.a

# Windows (MSVC)
/WHOLEARCHIVE:mulle-core-all-load.lib

Install

Use mulle-sde to build and install mulle-core-all-load and all dependencies:

mulle-sde install --prefix /usr/local \
   https://github.com/mulle-core/mulle-core-all-load/archive/latest.tar.gz

Manual Installation

Install the requirements:

Requirements Description
libbacktrace A C library that may be linked into a C/C++ program to produce symbolic backtraces
mulle-c11 πŸ”€ Cross-platform C compiler glue (and some cpp conveniences)
mulle-allocator πŸ”„ Flexible C memory allocation scheme
mulle-thread πŸ”  Cross-platform thread/mutex/tss/atomic operations in C
mulle-dlfcn ♿️ Shared library helper

Download the latest tar or zip archive and unpack it.

Install mulle-core-all-load into /usr/local with cmake:

PREFIX_DIR="/usr/local"
cmake -B build                               \
      -DMULLE_SDK_PATH="${PREFIX_DIR}"       \
      -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}" \
      -DCMAKE_PREFIX_PATH="${PREFIX_DIR}"    \
      -DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release

Author

Nat! for Mulle kybernetiK

About

πŸŒ‹ Almagamated library of mulle-atexit + friends

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages