summaryrefslogtreecommitdiff
path: root/Demos
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-08-12 01:58:50 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-12 20:40:59 +0200
commit9d2d97a05922599e714f2243b3d12248a386ac6a (patch)
tree2a40afc71d6889b573387a9c4d7aea0d30f9643a /Demos
parent9221a25bbc6048f8e63d8c5b40d2cb90e08d0a4a (diff)
downloadserenity-9d2d97a05922599e714f2243b3d12248a386ac6a.zip
LibC: Avoid ninja-imports of system functions
This adds a new header <sys/internals.h>, which provides access to LibC internals. This is in the interest of type-checking LibC itself, as well as enabling less-hacky access for uses like LinkDemo. And, of course, this progresses LibC towards building cleanly with -Wmissing-declarations.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/DynamicLink/LinkLib/DynamicLib.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/Demos/DynamicLink/LinkLib/DynamicLib.cpp b/Demos/DynamicLink/LinkLib/DynamicLib.cpp
index 547a206468..8e1a36dcb0 100644
--- a/Demos/DynamicLink/LinkLib/DynamicLib.cpp
+++ b/Demos/DynamicLink/LinkLib/DynamicLib.cpp
@@ -27,19 +27,17 @@
#include <AK/String.h>
#include <assert.h>
#include <stdio.h>
+#include <sys/internals.h>
char* __static_environ[] = { nullptr }; // We don't get the environment without some libc workarounds..
-// FIXME: Because we need to call printf, and we don't have access to the stout file descriptor
-// from the main executable. We need to call __libc_init....
-extern "C" void __libc_init();
-extern "C" bool __environ_is_malloced;
-
class Global {
public:
Global(int i)
: m_i(i)
{
+ // FIXME: Because we need to call printf, and we don't have access to the stdout
+ // file descriptor from the main executable, we need to initialize LibC ourself.
__environ_is_malloced = false;
environ = __static_environ;
__libc_init();