1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Demos: Add a dynamic linking demo to show off dlfcn methods

The LinkDemo program calls dlopen/dlsym/dlclose to try and load
a dyanmic library from /usr/lib. It read a global variable and
calls a global function (extern "C" of course :) ).

There a few hacks left in the LinkLib dynamic library, however.
In order to get the linker to stop complaining, we have to use
-nostartfiles -ffreestanding otherwise it will link crt0.o to our
shared object, which is definitely not right as the _init function
for a main program (that calls main) is not suitable for our lib
This commit is contained in:
Andrew Kaster 2019-12-31 16:43:11 -05:00 committed by Andreas Kling
parent 21161342ef
commit b6590b7f83
7 changed files with 179 additions and 1 deletions

View file

@ -110,6 +110,7 @@ cp ../Demos/HelloWorld/HelloWorld mnt/bin/HelloWorld
cp ../Demos/HelloWorld2/HelloWorld2 mnt/bin/HelloWorld2
cp ../Demos/WidgetGallery/WidgetGallery mnt/bin/WidgetGallery
cp ../Demos/Fire/Fire mnt/bin/Fire
cp ../Demos/DynamicLink/LinkDemo/LinkDemo mnt/bin/LinkDemo
cp ../DevTools/HackStudio/HackStudio mnt/bin/HackStudio
cp ../DevTools/VisualBuilder/VisualBuilder mnt/bin/VisualBuilder
cp ../DevTools/Inspector/Inspector mnt/bin/Inspector
@ -129,6 +130,10 @@ cp ../MenuApplets/CPUGraph/CPUGraph.MenuApplet mnt/bin/
cp ../MenuApplets/Clock/Clock.MenuApplet mnt/bin/
echo "done"
printf "installing dynamic libraries... "
cp ../Demos/DynamicLink/LinkLib/libDynamicLib.so mnt/usr/lib
echo "done"
printf "installing shortcuts... "
ln -s FileManager mnt/bin/fm
ln -s HelloWorld mnt/bin/hw