1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 14:37:45 +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

2
.gitignore vendored
View file

@ -8,7 +8,7 @@
*.o
*.ao
*.a
*.so
*.d
*.swp