mr4th-dynamic-linking/GUIDE.txt

62 lines
2.8 KiB
Plaintext
Raw Normal View History

#################################### Hello ####################################
The main goal of this investigation is to organize shared data and code across
multiple binary files. This is especially important for something like a base
layer that is used in a program that supports hot-reloading and/or plugins.
This repository contains examples of source and build details needed to achieve
dynamic linking (shared data and code) on Windows, and Linux, with the cl, gcc,
and clang compilers.
To start exploring an example navigate into the folder of the example and run
the build script from your command line. It should generate an executable in
a build/ folder. Each example also has a DETAILS.txt with info about the
details that go into the example's structure and the expected output of the
example program.
################################### Topics ####################################
Looking for a specific topic? This index tells you which example to jump to.
exporting symbols -> win32_linking, linux_linking
load-time import symbols -> win32_linking, linux_linking
run-time linking symbols -> win32_linking, linux_linking
building a .dll file -> win32_linking
building a .so file -> linux_linking
module initialization -> win32_before_main, linux_before_main
cl build line options -> win32_linking
gcc build line options -> linux_linking
linux load-time search paths -> linux_linking
clang build line options -> clang
abstracted base layer -> xlist
################################ The Examples #################################
An explanation of the main ideas in each example.
*_linking - Concrete examples for each operating system showing how to
setup and use various types of dynamic linking. In these
the "base" layer uses load-time linking, the "plugin" layer uses
run-time linking, and the "main" layer acts as the executable that
binds it all together into a process.
*_before_main - Concrete examples for each operating system showing how to
create a function that runs before main.
clang - Build scripts that build the concrete examples with clang instead of
cl or gcc. In each case clang can build the same source. In some cases
clang on windows can even build the linux source. The build lines for
clang that replace cl require some modification. The build lines for
clang that replace gcc have the exact same flags and inputs.
xlist - My prefered solution to the problem posed in the investigation which
relies only on run-time linking & before-main execution. It uses an
xlist to manage the maintenance burden of run-time linking, and a
basic outline of the abstracted form of the base layer.